From aa33192a4e1ce895b167b2423f59234d4e83e6fd 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 17:48:24 +0000 Subject: [PATCH] feat: Enable REST transport for most of Java and Go clients (#426) - [ ] 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-security-private-ca/pom.xml | 16 + .../v1/CertificateAuthorityServiceClient.java | 39 +- .../CertificateAuthorityServiceSettings.java | 23 +- .../stub/CertificateAuthorityServiceStub.java | 6 +- ...rtificateAuthorityServiceStubSettings.java | 53 +- ...ficateAuthorityServiceCallableFactory.java | 105 + ...tpJsonCertificateAuthorityServiceStub.java | 2475 +++++++++++ .../CertificateAuthorityServiceClient.java | 39 +- .../CertificateAuthorityServiceSettings.java | 23 +- .../stub/CertificateAuthorityServiceStub.java | 6 +- ...rtificateAuthorityServiceStubSettings.java | 53 +- ...ficateAuthorityServiceCallableFactory.java | 105 + ...tpJsonCertificateAuthorityServiceStub.java | 1559 +++++++ ...ateAuthorityServiceClientHttpJsonTest.java | 3653 +++++++++++++++++ ...ateAuthorityServiceClientHttpJsonTest.java | 2420 +++++++++++ .../AsyncActivateCertificateAuthority.java | 58 + .../AsyncActivateCertificateAuthorityLRO.java | 60 + .../SyncActivateCertificateAuthority.java | 53 + ...cateAuthorityCertificateauthorityname.java | 45 + ...yncActivateCertificateAuthorityString.java | 46 + .../SyncCreateSetCredentialsProvider.java | 43 + .../SyncCreateSetCredentialsProvider1.java | 44 + .../create/SyncCreateSetEndpoint.java | 39 + .../createcapool/AsyncCreateCaPool.java | 52 + .../createcapool/AsyncCreateCaPoolLRO.java | 52 + .../createcapool/SyncCreateCaPool.java | 47 + ...cCreateCaPoolLocationnameCapoolString.java | 45 + .../SyncCreateCaPoolStringCapoolString.java | 45 + .../AsyncCreateCertificate.java | 53 + .../SyncCreateCertificate.java | 49 + ...ertificateCapoolnameCertificateString.java | 45 + ...ateCertificateStringCertificateString.java | 45 + .../AsyncCreateCertificateAuthority.java | 54 + .../AsyncCreateCertificateAuthorityLRO.java | 56 + .../SyncCreateCertificateAuthority.java | 48 + ...yCapoolnameCertificateauthorityString.java | 48 + ...orityStringCertificateauthorityString.java | 48 + .../AsyncCreateCertificateTemplate.java | 52 + .../AsyncCreateCertificateTemplateLRO.java | 56 + .../SyncCreateCertificateTemplate.java | 48 + ...LocationnameCertificatetemplateString.java | 48 + ...mplateStringCertificatetemplateString.java | 48 + .../deletecapool/AsyncDeleteCaPool.java | 49 + .../deletecapool/AsyncDeleteCaPoolLRO.java | 50 + .../deletecapool/SyncDeleteCaPool.java | 44 + .../SyncDeleteCaPoolCapoolname.java | 39 + .../deletecapool/SyncDeleteCaPoolString.java | 39 + .../AsyncDeleteCertificateAuthority.java | 56 + .../AsyncDeleteCertificateAuthorityLRO.java | 59 + .../SyncDeleteCertificateAuthority.java | 51 + ...cateAuthorityCertificateauthorityname.java | 45 + .../SyncDeleteCertificateAuthorityString.java | 46 + .../AsyncDeleteCertificateTemplate.java | 51 + .../AsyncDeleteCertificateTemplateLRO.java | 56 + .../SyncDeleteCertificateTemplate.java | 46 + ...ficateTemplateCertificatetemplatename.java | 42 + .../SyncDeleteCertificateTemplateString.java | 43 + .../AsyncDisableCertificateAuthority.java | 55 + .../AsyncDisableCertificateAuthorityLRO.java | 57 + .../SyncDisableCertificateAuthority.java | 49 + ...cateAuthorityCertificateauthorityname.java | 45 + ...SyncDisableCertificateAuthorityString.java | 46 + .../AsyncEnableCertificateAuthority.java | 54 + .../AsyncEnableCertificateAuthorityLRO.java | 57 + .../SyncEnableCertificateAuthority.java | 49 + ...cateAuthorityCertificateauthorityname.java | 45 + .../SyncEnableCertificateAuthorityString.java | 46 + .../fetchcacerts/AsyncFetchCaCerts.java | 49 + .../fetchcacerts/SyncFetchCaCerts.java | 45 + .../SyncFetchCaCertsCapoolname.java | 40 + .../fetchcacerts/SyncFetchCaCertsString.java | 40 + .../AsyncFetchCertificateAuthorityCsr.java | 54 + .../SyncFetchCertificateAuthorityCsr.java | 49 + ...eAuthorityCsrCertificateauthorityname.java | 45 + ...yncFetchCertificateAuthorityCsrString.java | 46 + .../getcapool/AsyncGetCaPool.java | 48 + .../getcapool/SyncGetCaPool.java | 44 + .../getcapool/SyncGetCaPoolCapoolname.java | 40 + .../getcapool/SyncGetCaPoolString.java | 40 + .../getcertificate/AsyncGetCertificate.java | 50 + .../getcertificate/SyncGetCertificate.java | 46 + .../SyncGetCertificateCertificatename.java | 43 + .../SyncGetCertificateString.java | 41 + .../AsyncGetCertificateAuthority.java | 51 + .../SyncGetCertificateAuthority.java | 48 + ...cateAuthorityCertificateauthorityname.java | 45 + .../SyncGetCertificateAuthorityString.java | 46 + .../AsyncGetCertificateRevocationList.java | 58 + .../SyncGetCertificateRevocationList.java | 53 + ...tionListCertificaterevocationlistname.java | 50 + ...yncGetCertificateRevocationListString.java | 50 + .../AsyncGetCertificateTemplate.java | 50 + .../SyncGetCertificateTemplate.java | 47 + ...ficateTemplateCertificatetemplatename.java | 43 + .../SyncGetCertificateTemplateString.java | 43 + .../getiampolicy/AsyncGetIamPolicy.java | 50 + .../getiampolicy/SyncGetIamPolicy.java | 46 + .../getlocation/AsyncGetLocation.java | 44 + .../getlocation/SyncGetLocation.java | 40 + .../listcapools/AsyncListCaPools.java | 54 + .../listcapools/AsyncListCaPoolsPaged.java | 62 + .../listcapools/SyncListCaPools.java | 50 + .../SyncListCaPoolsLocationname.java | 42 + .../listcapools/SyncListCaPoolsString.java | 42 + .../AsyncListCertificateAuthorities.java | 56 + .../AsyncListCertificateAuthoritiesPaged.java | 64 + .../SyncListCertificateAuthorities.java | 51 + ...cListCertificateAuthoritiesCapoolname.java | 45 + .../SyncListCertificateAuthoritiesString.java | 45 + .../AsyncListCertificateRevocationLists.java | 61 + ...ncListCertificateRevocationListsPaged.java | 69 + .../SyncListCertificateRevocationLists.java | 56 + ...vocationListsCertificateauthorityname.java | 47 + ...cListCertificateRevocationListsString.java | 48 + .../AsyncListCertificates.java | 54 + .../AsyncListCertificatesPaged.java | 62 + .../SyncListCertificates.java | 51 + .../SyncListCertificatesCapoolname.java | 43 + .../SyncListCertificatesString.java | 43 + .../AsyncListCertificateTemplates.java | 56 + .../AsyncListCertificateTemplatesPaged.java | 64 + .../SyncListCertificateTemplates.java | 51 + ...cListCertificateTemplatesLocationname.java | 45 + .../SyncListCertificateTemplatesString.java | 45 + .../listlocations/AsyncListLocations.java | 52 + .../AsyncListLocationsPaged.java | 60 + .../listlocations/SyncListLocations.java | 49 + .../AsyncRevokeCertificate.java | 53 + .../SyncRevokeCertificate.java | 49 + .../SyncRevokeCertificateCertificatename.java | 43 + .../SyncRevokeCertificateString.java | 41 + .../setiampolicy/AsyncSetIamPolicy.java | 51 + .../setiampolicy/SyncSetIamPolicy.java | 47 + .../AsyncTestIamPermissions.java | 50 + .../SyncTestIamPermissions.java | 47 + .../AsyncUndeleteCertificateAuthority.java | 55 + .../AsyncUndeleteCertificateAuthorityLRO.java | 57 + .../SyncUndeleteCertificateAuthority.java | 50 + ...cateAuthorityCertificateauthorityname.java | 45 + ...yncUndeleteCertificateAuthorityString.java | 46 + .../updatecapool/AsyncUpdateCaPool.java | 51 + .../updatecapool/AsyncUpdateCaPoolLRO.java | 51 + .../updatecapool/SyncUpdateCaPool.java | 46 + .../SyncUpdateCaPoolCapoolFieldmask.java | 43 + .../AsyncUpdateCertificate.java | 50 + .../SyncUpdateCertificate.java | 46 + ...UpdateCertificateCertificateFieldmask.java | 44 + .../AsyncUpdateCertificateAuthority.java | 53 + .../AsyncUpdateCertificateAuthorityLRO.java | 55 + .../SyncUpdateCertificateAuthority.java | 47 + ...uthorityCertificateauthorityFieldmask.java | 47 + .../AsyncUpdateCertificateRevocationList.java | 55 + ...yncUpdateCertificateRevocationListLRO.java | 55 + .../SyncUpdateCertificateRevocationList.java | 49 + ...istCertificaterevocationlistFieldmask.java | 48 + .../AsyncUpdateCertificateTemplate.java | 51 + .../AsyncUpdateCertificateTemplateLRO.java | 55 + .../SyncUpdateCertificateTemplate.java | 47 + ...eTemplateCertificatetemplateFieldmask.java | 46 + .../SyncCreateCertificate.java | 47 + .../SyncCreateCertificate.java | 47 + .../AsyncActivateCertificateAuthority.java | 58 + .../AsyncActivateCertificateAuthorityLRO.java | 59 + .../SyncActivateCertificateAuthority.java | 53 + ...cateAuthorityCertificateauthorityname.java | 44 + ...yncActivateCertificateAuthorityString.java | 45 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 44 + .../create/SyncCreateSetEndpoint.java | 39 + .../AsyncCreateCertificate.java | 53 + .../SyncCreateCertificate.java | 49 + ...ificateauthoritynameCertificateString.java | 47 + ...ateCertificateStringCertificateString.java | 47 + .../AsyncCreateCertificateAuthority.java | 56 + .../AsyncCreateCertificateAuthorityLRO.java | 56 + .../SyncCreateCertificateAuthority.java | 50 + ...ocationnameCertificateauthorityString.java | 48 + ...orityStringCertificateauthorityString.java | 48 + .../AsyncDisableCertificateAuthority.java | 55 + .../AsyncDisableCertificateAuthorityLRO.java | 56 + .../SyncDisableCertificateAuthority.java | 50 + ...cateAuthorityCertificateauthorityname.java | 44 + ...SyncDisableCertificateAuthorityString.java | 45 + .../AsyncEnableCertificateAuthority.java | 55 + .../AsyncEnableCertificateAuthorityLRO.java | 56 + .../SyncEnableCertificateAuthority.java | 50 + ...cateAuthorityCertificateauthorityname.java | 44 + .../SyncEnableCertificateAuthorityString.java | 45 + .../AsyncFetchCertificateAuthorityCsr.java | 54 + .../SyncFetchCertificateAuthorityCsr.java | 49 + ...eAuthorityCsrCertificateauthorityname.java | 44 + ...yncFetchCertificateAuthorityCsrString.java | 45 + .../getcertificate/AsyncGetCertificate.java | 51 + .../getcertificate/SyncGetCertificate.java | 47 + .../SyncGetCertificateCertificatename.java | 43 + .../SyncGetCertificateString.java | 42 + .../AsyncGetCertificateAuthority.java | 51 + .../SyncGetCertificateAuthority.java | 48 + ...cateAuthorityCertificateauthorityname.java | 44 + .../SyncGetCertificateAuthorityString.java | 45 + .../AsyncGetCertificateRevocationList.java | 58 + .../SyncGetCertificateRevocationList.java | 53 + ...tionListCertificaterevocationlistname.java | 49 + ...yncGetCertificateRevocationListString.java | 49 + .../AsyncGetReusableConfig.java | 49 + .../SyncGetReusableConfig.java | 45 + ...ncGetReusableConfigReusableconfigname.java | 43 + .../SyncGetReusableConfigString.java | 42 + .../AsyncListCertificateAuthorities.java | 58 + .../AsyncListCertificateAuthoritiesPaged.java | 64 + .../SyncListCertificateAuthorities.java | 53 + ...istCertificateAuthoritiesLocationname.java | 45 + .../SyncListCertificateAuthoritiesString.java | 45 + .../AsyncListCertificateRevocationLists.java | 60 + ...ncListCertificateRevocationListsPaged.java | 68 + .../SyncListCertificateRevocationLists.java | 55 + ...vocationListsCertificateauthorityname.java | 46 + ...cListCertificateRevocationListsString.java | 47 + .../AsyncListCertificates.java | 56 + .../AsyncListCertificatesPaged.java | 65 + .../SyncListCertificates.java | 53 + ...tCertificatesCertificateauthorityname.java | 46 + .../SyncListCertificatesString.java | 46 + .../AsyncListReusableConfigs.java | 54 + .../AsyncListReusableConfigsPaged.java | 64 + .../SyncListReusableConfigs.java | 51 + .../SyncListReusableConfigsLocationname.java | 45 + .../SyncListReusableConfigsString.java | 45 + .../AsyncRestoreCertificateAuthority.java | 55 + .../AsyncRestoreCertificateAuthorityLRO.java | 56 + .../SyncRestoreCertificateAuthority.java | 50 + ...cateAuthorityCertificateauthorityname.java | 44 + ...SyncRestoreCertificateAuthorityString.java | 45 + .../AsyncRevokeCertificate.java | 54 + .../SyncRevokeCertificate.java | 50 + .../SyncRevokeCertificateCertificatename.java | 43 + .../SyncRevokeCertificateString.java | 43 + ...yncScheduleDeleteCertificateAuthority.java | 55 + ...ScheduleDeleteCertificateAuthorityLRO.java | 56 + ...yncScheduleDeleteCertificateAuthority.java | 50 + ...cateAuthorityCertificateauthorityname.java | 45 + ...eduleDeleteCertificateAuthorityString.java | 45 + .../AsyncUpdateCertificate.java | 50 + .../SyncUpdateCertificate.java | 46 + ...UpdateCertificateCertificateFieldmask.java | 44 + .../AsyncUpdateCertificateAuthority.java | 55 + .../AsyncUpdateCertificateAuthorityLRO.java | 55 + .../SyncUpdateCertificateAuthority.java | 49 + ...uthorityCertificateauthorityFieldmask.java | 47 + .../AsyncUpdateCertificateRevocationList.java | 55 + ...yncUpdateCertificateRevocationListLRO.java | 55 + .../SyncUpdateCertificateRevocationList.java | 49 + ...istCertificaterevocationlistFieldmask.java | 48 + .../SyncCreateCertificate.java | 47 + .../SyncCreateCertificate.java | 48 + 255 files changed, 22413 insertions(+), 22 deletions(-) create mode 100644 google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java create mode 100644 google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceStub.java create mode 100644 google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java create mode 100644 google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceStub.java create mode 100644 google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClientHttpJsonTest.java create mode 100644 google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPoolLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolLocationnameCapoolString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolStringCapoolString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCapoolnameCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityCapoolnameCertificateauthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplateLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateLocationnameCertificatetemplateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateStringCertificatetemplateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPoolLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolCapoolname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplateLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateCertificatetemplatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/AsyncFetchCaCerts.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCerts.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsCapoolname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/AsyncGetCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolCapoolname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/AsyncGetCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateCertificatetemplatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/AsyncGetIamPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/SyncGetIamPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/AsyncGetLocation.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/SyncGetLocation.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPools.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPoolsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPools.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesCapoolname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCapoolname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplatesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocations.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocationsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/SyncListLocations.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/AsyncSetIamPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/SyncSetIamPolicy.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/AsyncTestIamPermissions.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/SyncTestIamPermissions.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPoolLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPool.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPoolCapoolFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplateLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplateCertificatetemplateFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCertificateauthoritynameCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityLocationnameCertificateauthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/AsyncGetReusableConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfig.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigReusableconfigname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigs.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsLocationname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityCertificateauthorityname.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityString.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java create mode 100644 samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java diff --git a/google-cloud-security-private-ca/pom.xml b/google-cloud-security-private-ca/pom.xml index e72d4d76..f26e4455 100644 --- a/google-cloud-security-private-ca/pom.xml +++ b/google-cloud-security-private-ca/pom.xml @@ -74,6 +74,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -98,12 +102,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-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClient.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClient.java index 82cac796..c03eba1f 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClient.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClient.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; @@ -39,7 +40,6 @@ import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -120,13 +120,30 @@ * CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); * } * + *

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.
+ * CertificateAuthorityServiceSettings certificateAuthorityServiceSettings =
+ *     CertificateAuthorityServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ *                 .build())
+ *         .build();
+ * CertificateAuthorityServiceClient certificateAuthorityServiceClient =
+ *     CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class CertificateAuthorityServiceClient implements BackgroundResource { private final CertificateAuthorityServiceSettings settings; private final CertificateAuthorityServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of CertificateAuthorityServiceClient with default settings. */ public static final CertificateAuthorityServiceClient create() throws IOException { @@ -161,13 +178,17 @@ protected CertificateAuthorityServiceClient(CertificateAuthorityServiceSettings throws IOException { this.settings = settings; this.stub = ((CertificateAuthorityServiceStubSettings) 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 CertificateAuthorityServiceClient(CertificateAuthorityServiceStub 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 CertificateAuthorityServiceSettings getSettings() { @@ -182,10 +203,18 @@ public CertificateAuthorityServiceStub 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. /** * Create a new [Certificate][google.cloud.security.privateca.v1.Certificate] in a given Project, diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceSettings.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceSettings.java index 1cd5d8e7..4ba52422 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceSettings.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceSettings.java @@ -28,6 +28,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; @@ -448,11 +449,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return CertificateAuthorityServiceStubSettings.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 CertificateAuthorityServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return CertificateAuthorityServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return CertificateAuthorityServiceStubSettings.defaultTransportChannelProvider(); } @@ -462,11 +470,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return CertificateAuthorityServiceStubSettings.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); @@ -505,6 +519,11 @@ private static Builder createDefault() { return new Builder(CertificateAuthorityServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(CertificateAuthorityServiceStubSettings.newHttpJsonBuilder()); + } + public CertificateAuthorityServiceStubSettings.Builder getStubSettingsBuilder() { return ((CertificateAuthorityServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStub.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStub.java index c4c43cf9..7f836841 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStub.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStub.java @@ -92,7 +92,11 @@ public abstract class CertificateAuthorityServiceStub 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 createCertificateCallable() { diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStubSettings.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStubSettings.java index 834b8faf..0d7df8d0 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStubSettings.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/CertificateAuthorityServiceStubSettings.java @@ -33,6 +33,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; @@ -961,6 +964,11 @@ public CertificateAuthorityServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcCertificateAuthorityServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonCertificateAuthorityServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -993,18 +1001,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(CertificateAuthorityServiceStubSettings.class)) @@ -1012,11 +1027,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(CertificateAuthorityServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CertificateAuthorityServiceStubSettings.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); @@ -1475,6 +1509,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 .createCertificateSettings() diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java new file mode 100644 index 00000000..e718e9e1 --- /dev/null +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.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.security.privateca.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 CertificateAuthorityService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCertificateAuthorityServiceCallableFactory + 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-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceStub.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceStub.java new file mode 100644 index 00000000..dacf5821 --- /dev/null +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1/stub/HttpJsonCertificateAuthorityServiceStub.java @@ -0,0 +1,2475 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.stub; + +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCaPoolsPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateAuthoritiesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateRevocationListsPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateTemplatesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificatesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListLocationsPagedResponse; + +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.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CreateCaPoolRequest; +import com.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.CreateCertificateRequest; +import com.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.DeleteCaPoolRequest; +import com.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.FetchCaCertsRequest; +import com.google.cloud.security.privateca.v1.FetchCaCertsResponse; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse; +import com.google.cloud.security.privateca.v1.GetCaPoolRequest; +import com.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.GetCertificateRequest; +import com.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest; +import com.google.cloud.security.privateca.v1.GetCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.ListCaPoolsRequest; +import com.google.cloud.security.privateca.v1.ListCaPoolsResponse; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesResponse; +import com.google.cloud.security.privateca.v1.ListCertificatesRequest; +import com.google.cloud.security.privateca.v1.ListCertificatesResponse; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.RevokeCertificateRequest; +import com.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.UpdateCaPoolRequest; +import com.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.UpdateCertificateRequest; +import com.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest; +import com.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +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 CertificateAuthorityService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonCertificateAuthorityServiceStub extends CertificateAuthorityServiceStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(Empty.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .add(CaPool.getDescriptor()) + .add(CertificateRevocationList.getDescriptor()) + .add(CertificateAuthority.getDescriptor()) + .add(CertificateTemplate.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/caPools/*}/certificates", + 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, "certificateId", request.getCertificateId()); + serializer.putQueryParam( + fields, + "issuingCertificateAuthorityId", + request.getIssuingCertificateAuthorityId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificate") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}", + 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(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listCertificatesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificates") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/caPools/*}/certificates", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificatesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + revokeCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/RevokeCertificate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificates/*}:revoke", + 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(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificate") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificate.name=projects/*/locations/*/caPools/*/certificates/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "certificate.name", request.getCertificate().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + activateCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ActivateCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}: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( + (ActivateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities", + 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, + "certificateAuthorityId", + request.getCertificateAuthorityId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateAuthority", request.getCertificateAuthority())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + disableCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/DisableCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:disable", + 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( + (DisableCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + enableCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/EnableCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:enable", + 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( + (EnableCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + FetchCertificateAuthorityCsrRequest, FetchCertificateAuthorityCsrResponse> + fetchCertificateAuthorityCsrMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCertificateAuthorityCsr") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:fetch", + 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(FetchCertificateAuthorityCsrResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateAuthority") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}", + 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(CertificateAuthority.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateAuthoritiesRequest, ListCertificateAuthoritiesResponse> + listCertificateAuthoritiesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateAuthorities") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/caPools/*}/certificateAuthorities", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificateAuthoritiesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + undeleteCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UndeleteCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}:undelete", + 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( + (UndeleteCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateAuthority") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*}", + 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, + "ignoreActiveCertificates", + request.getIgnoreActiveCertificates()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam( + fields, "skipGracePeriod", request.getSkipGracePeriod()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateAuthority") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificateAuthority.name=projects/*/locations/*/caPools/*/certificateAuthorities/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateAuthority.name", + request.getCertificateAuthority().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateAuthority", request.getCertificateAuthority())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createCaPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCaPool") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/caPools", + 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, "caPoolId", request.getCaPoolId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("caPool", request.getCaPool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCaPoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCaPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCaPool") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{caPool.name=projects/*/locations/*/caPools/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "caPool.name", request.getCaPool().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("caPool", request.getCaPool())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCaPoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getCaPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/GetCaPool") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*}", + 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(CaPool.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listCaPoolsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ListCaPools") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/caPools", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCaPoolsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteCaPoolMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCaPool") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*}", + 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, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCaPoolRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + fetchCaCertsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/FetchCaCerts") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{caPool=projects/*/locations/*/caPools/*}:fetchCaCerts", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "caPool", request.getCaPool()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearCaPool().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(FetchCaCertsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetCertificateRevocationListRequest, CertificateRevocationList> + getCertificateRevocationListMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateRevocationList") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}", + 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(CertificateRevocationList.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateRevocationLists") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/caPools/*/certificateAuthorities/*}/certificateRevocationLists", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListCertificateRevocationListsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCertificateRevocationListMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateRevocationList") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificateRevocationList.name=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateRevocationList.name", + request.getCertificateRevocationList().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateRevocationList", + request.getCertificateRevocationList())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateRevocationListRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createCertificateTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/CreateCertificateTemplate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificateTemplates", + 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, + "certificateTemplateId", + request.getCertificateTemplateId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateTemplate", request.getCertificateTemplate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateTemplateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deleteCertificateTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/DeleteCertificateTemplate") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateTemplates/*}", + 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, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteCertificateTemplateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getCertificateTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/GetCertificateTemplate") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/certificateTemplates/*}", + 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(CertificateTemplate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateTemplatesRequest, ListCertificateTemplatesResponse> + listCertificateTemplatesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/ListCertificateTemplates") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/certificateTemplates", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificateTemplatesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCertificateTemplateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1.CertificateAuthorityService/UpdateCertificateTemplate") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{certificateTemplate.name=projects/*/locations/*/certificateTemplates/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateTemplate.name", + request.getCertificateTemplate().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificateTemplate", request.getCertificateTemplate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateTemplateRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listLocationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/ListLocations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*}/locations", + 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(ListLocationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getLocationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.location.Locations/GetLocation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*}", + 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(Location.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/caPools/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/locations/*/certificateTemplates/*}:setIamPolicy", + "/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:setIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/caPools/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/locations/*/certificateTemplates/*}:getIamPolicy", + "/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:getIamPolicy") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{resource=projects/*/locations/*/caPools/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1/{resource=projects/*/locations/*/certificateTemplates/*}:testIamPermissions", + "/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:testIamPermissions") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createCertificateCallable; + private final UnaryCallable getCertificateCallable; + private final UnaryCallable + listCertificatesCallable; + private final UnaryCallable + listCertificatesPagedCallable; + private final UnaryCallable revokeCertificateCallable; + private final UnaryCallable updateCertificateCallable; + private final UnaryCallable + activateCertificateAuthorityCallable; + private final OperationCallable< + ActivateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + activateCertificateAuthorityOperationCallable; + private final UnaryCallable + createCertificateAuthorityCallable; + private final OperationCallable< + CreateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + createCertificateAuthorityOperationCallable; + private final UnaryCallable + disableCertificateAuthorityCallable; + private final OperationCallable< + DisableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + disableCertificateAuthorityOperationCallable; + private final UnaryCallable + enableCertificateAuthorityCallable; + private final OperationCallable< + EnableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + enableCertificateAuthorityOperationCallable; + private final UnaryCallable< + FetchCertificateAuthorityCsrRequest, FetchCertificateAuthorityCsrResponse> + fetchCertificateAuthorityCsrCallable; + private final UnaryCallable + getCertificateAuthorityCallable; + private final UnaryCallable + listCertificateAuthoritiesCallable; + private final UnaryCallable< + ListCertificateAuthoritiesRequest, ListCertificateAuthoritiesPagedResponse> + listCertificateAuthoritiesPagedCallable; + private final UnaryCallable + undeleteCertificateAuthorityCallable; + private final OperationCallable< + UndeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + undeleteCertificateAuthorityOperationCallable; + private final UnaryCallable + deleteCertificateAuthorityCallable; + private final OperationCallable< + DeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + deleteCertificateAuthorityOperationCallable; + private final UnaryCallable + updateCertificateAuthorityCallable; + private final OperationCallable< + UpdateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + updateCertificateAuthorityOperationCallable; + private final UnaryCallable createCaPoolCallable; + private final OperationCallable + createCaPoolOperationCallable; + private final UnaryCallable updateCaPoolCallable; + private final OperationCallable + updateCaPoolOperationCallable; + private final UnaryCallable getCaPoolCallable; + private final UnaryCallable listCaPoolsCallable; + private final UnaryCallable + listCaPoolsPagedCallable; + private final UnaryCallable deleteCaPoolCallable; + private final OperationCallable + deleteCaPoolOperationCallable; + private final UnaryCallable fetchCaCertsCallable; + private final UnaryCallable + getCertificateRevocationListCallable; + private final UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsCallable; + private final UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsPagedResponse> + listCertificateRevocationListsPagedCallable; + private final UnaryCallable + updateCertificateRevocationListCallable; + private final OperationCallable< + UpdateCertificateRevocationListRequest, CertificateRevocationList, OperationMetadata> + updateCertificateRevocationListOperationCallable; + private final UnaryCallable + createCertificateTemplateCallable; + private final OperationCallable< + CreateCertificateTemplateRequest, CertificateTemplate, OperationMetadata> + createCertificateTemplateOperationCallable; + private final UnaryCallable + deleteCertificateTemplateCallable; + private final OperationCallable + deleteCertificateTemplateOperationCallable; + private final UnaryCallable + getCertificateTemplateCallable; + private final UnaryCallable + listCertificateTemplatesCallable; + private final UnaryCallable< + ListCertificateTemplatesRequest, ListCertificateTemplatesPagedResponse> + listCertificateTemplatesPagedCallable; + private final UnaryCallable + updateCertificateTemplateCallable; + private final OperationCallable< + UpdateCertificateTemplateRequest, CertificateTemplate, OperationMetadata> + updateCertificateTemplateOperationCallable; + private final UnaryCallable listLocationsCallable; + private final UnaryCallable + listLocationsPagedCallable; + private final UnaryCallable getLocationCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonCertificateAuthorityServiceStub create( + CertificateAuthorityServiceStubSettings settings) throws IOException { + return new HttpJsonCertificateAuthorityServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonCertificateAuthorityServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonCertificateAuthorityServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonCertificateAuthorityServiceStub, 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 HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonCertificateAuthorityServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonCertificateAuthorityServiceStub, 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 HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificatesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCertificatesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings revokeCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(revokeCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + activateCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(activateCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + disableCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(disableCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + enableCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(enableCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + fetchCertificateAuthorityCsrTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(fetchCertificateAuthorityCsrMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificateAuthoritiesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCertificateAuthoritiesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + undeleteCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeleteCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createCaPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCaPoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCaPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCaPoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCaPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCaPoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listCaPoolsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCaPoolsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteCaPoolTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCaPoolMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings fetchCaCertsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(fetchCaCertsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateRevocationListTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getCertificateRevocationListMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listCertificateRevocationListsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateRevocationListTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateRevocationListMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCertificateTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateTemplateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteCertificateTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteCertificateTemplateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateTemplateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificateTemplatesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCertificateTemplatesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateTemplateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateTemplateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listLocationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listLocationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getLocationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getLocationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createCertificateCallable = + callableFactory.createUnaryCallable( + createCertificateTransportSettings, + settings.createCertificateSettings(), + clientContext); + this.getCertificateCallable = + callableFactory.createUnaryCallable( + getCertificateTransportSettings, settings.getCertificateSettings(), clientContext); + this.listCertificatesCallable = + callableFactory.createUnaryCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.listCertificatesPagedCallable = + callableFactory.createPagedCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.revokeCertificateCallable = + callableFactory.createUnaryCallable( + revokeCertificateTransportSettings, + settings.revokeCertificateSettings(), + clientContext); + this.updateCertificateCallable = + callableFactory.createUnaryCallable( + updateCertificateTransportSettings, + settings.updateCertificateSettings(), + clientContext); + this.activateCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + activateCertificateAuthorityTransportSettings, + settings.activateCertificateAuthoritySettings(), + clientContext); + this.activateCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + activateCertificateAuthorityTransportSettings, + settings.activateCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + createCertificateAuthorityTransportSettings, + settings.createCertificateAuthoritySettings(), + clientContext); + this.createCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + createCertificateAuthorityTransportSettings, + settings.createCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.disableCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + disableCertificateAuthorityTransportSettings, + settings.disableCertificateAuthoritySettings(), + clientContext); + this.disableCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + disableCertificateAuthorityTransportSettings, + settings.disableCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.enableCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + enableCertificateAuthorityTransportSettings, + settings.enableCertificateAuthoritySettings(), + clientContext); + this.enableCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + enableCertificateAuthorityTransportSettings, + settings.enableCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.fetchCertificateAuthorityCsrCallable = + callableFactory.createUnaryCallable( + fetchCertificateAuthorityCsrTransportSettings, + settings.fetchCertificateAuthorityCsrSettings(), + clientContext); + this.getCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + getCertificateAuthorityTransportSettings, + settings.getCertificateAuthoritySettings(), + clientContext); + this.listCertificateAuthoritiesCallable = + callableFactory.createUnaryCallable( + listCertificateAuthoritiesTransportSettings, + settings.listCertificateAuthoritiesSettings(), + clientContext); + this.listCertificateAuthoritiesPagedCallable = + callableFactory.createPagedCallable( + listCertificateAuthoritiesTransportSettings, + settings.listCertificateAuthoritiesSettings(), + clientContext); + this.undeleteCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + undeleteCertificateAuthorityTransportSettings, + settings.undeleteCertificateAuthoritySettings(), + clientContext); + this.undeleteCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + undeleteCertificateAuthorityTransportSettings, + settings.undeleteCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + deleteCertificateAuthorityTransportSettings, + settings.deleteCertificateAuthoritySettings(), + clientContext); + this.deleteCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + deleteCertificateAuthorityTransportSettings, + settings.deleteCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + updateCertificateAuthorityTransportSettings, + settings.updateCertificateAuthoritySettings(), + clientContext); + this.updateCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + updateCertificateAuthorityTransportSettings, + settings.updateCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createCaPoolCallable = + callableFactory.createUnaryCallable( + createCaPoolTransportSettings, settings.createCaPoolSettings(), clientContext); + this.createCaPoolOperationCallable = + callableFactory.createOperationCallable( + createCaPoolTransportSettings, + settings.createCaPoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCaPoolCallable = + callableFactory.createUnaryCallable( + updateCaPoolTransportSettings, settings.updateCaPoolSettings(), clientContext); + this.updateCaPoolOperationCallable = + callableFactory.createOperationCallable( + updateCaPoolTransportSettings, + settings.updateCaPoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getCaPoolCallable = + callableFactory.createUnaryCallable( + getCaPoolTransportSettings, settings.getCaPoolSettings(), clientContext); + this.listCaPoolsCallable = + callableFactory.createUnaryCallable( + listCaPoolsTransportSettings, settings.listCaPoolsSettings(), clientContext); + this.listCaPoolsPagedCallable = + callableFactory.createPagedCallable( + listCaPoolsTransportSettings, settings.listCaPoolsSettings(), clientContext); + this.deleteCaPoolCallable = + callableFactory.createUnaryCallable( + deleteCaPoolTransportSettings, settings.deleteCaPoolSettings(), clientContext); + this.deleteCaPoolOperationCallable = + callableFactory.createOperationCallable( + deleteCaPoolTransportSettings, + settings.deleteCaPoolOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.fetchCaCertsCallable = + callableFactory.createUnaryCallable( + fetchCaCertsTransportSettings, settings.fetchCaCertsSettings(), clientContext); + this.getCertificateRevocationListCallable = + callableFactory.createUnaryCallable( + getCertificateRevocationListTransportSettings, + settings.getCertificateRevocationListSettings(), + clientContext); + this.listCertificateRevocationListsCallable = + callableFactory.createUnaryCallable( + listCertificateRevocationListsTransportSettings, + settings.listCertificateRevocationListsSettings(), + clientContext); + this.listCertificateRevocationListsPagedCallable = + callableFactory.createPagedCallable( + listCertificateRevocationListsTransportSettings, + settings.listCertificateRevocationListsSettings(), + clientContext); + this.updateCertificateRevocationListCallable = + callableFactory.createUnaryCallable( + updateCertificateRevocationListTransportSettings, + settings.updateCertificateRevocationListSettings(), + clientContext); + this.updateCertificateRevocationListOperationCallable = + callableFactory.createOperationCallable( + updateCertificateRevocationListTransportSettings, + settings.updateCertificateRevocationListOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createCertificateTemplateCallable = + callableFactory.createUnaryCallable( + createCertificateTemplateTransportSettings, + settings.createCertificateTemplateSettings(), + clientContext); + this.createCertificateTemplateOperationCallable = + callableFactory.createOperationCallable( + createCertificateTemplateTransportSettings, + settings.createCertificateTemplateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteCertificateTemplateCallable = + callableFactory.createUnaryCallable( + deleteCertificateTemplateTransportSettings, + settings.deleteCertificateTemplateSettings(), + clientContext); + this.deleteCertificateTemplateOperationCallable = + callableFactory.createOperationCallable( + deleteCertificateTemplateTransportSettings, + settings.deleteCertificateTemplateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getCertificateTemplateCallable = + callableFactory.createUnaryCallable( + getCertificateTemplateTransportSettings, + settings.getCertificateTemplateSettings(), + clientContext); + this.listCertificateTemplatesCallable = + callableFactory.createUnaryCallable( + listCertificateTemplatesTransportSettings, + settings.listCertificateTemplatesSettings(), + clientContext); + this.listCertificateTemplatesPagedCallable = + callableFactory.createPagedCallable( + listCertificateTemplatesTransportSettings, + settings.listCertificateTemplatesSettings(), + clientContext); + this.updateCertificateTemplateCallable = + callableFactory.createUnaryCallable( + updateCertificateTemplateTransportSettings, + settings.updateCertificateTemplateSettings(), + clientContext); + this.updateCertificateTemplateOperationCallable = + callableFactory.createOperationCallable( + updateCertificateTemplateTransportSettings, + settings.updateCertificateTemplateOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listLocationsCallable = + callableFactory.createUnaryCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.listLocationsPagedCallable = + callableFactory.createPagedCallable( + listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); + this.getLocationCallable = + callableFactory.createUnaryCallable( + getLocationTransportSettings, settings.getLocationSettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createCertificateMethodDescriptor); + methodDescriptors.add(getCertificateMethodDescriptor); + methodDescriptors.add(listCertificatesMethodDescriptor); + methodDescriptors.add(revokeCertificateMethodDescriptor); + methodDescriptors.add(updateCertificateMethodDescriptor); + methodDescriptors.add(activateCertificateAuthorityMethodDescriptor); + methodDescriptors.add(createCertificateAuthorityMethodDescriptor); + methodDescriptors.add(disableCertificateAuthorityMethodDescriptor); + methodDescriptors.add(enableCertificateAuthorityMethodDescriptor); + methodDescriptors.add(fetchCertificateAuthorityCsrMethodDescriptor); + methodDescriptors.add(getCertificateAuthorityMethodDescriptor); + methodDescriptors.add(listCertificateAuthoritiesMethodDescriptor); + methodDescriptors.add(undeleteCertificateAuthorityMethodDescriptor); + methodDescriptors.add(deleteCertificateAuthorityMethodDescriptor); + methodDescriptors.add(updateCertificateAuthorityMethodDescriptor); + methodDescriptors.add(createCaPoolMethodDescriptor); + methodDescriptors.add(updateCaPoolMethodDescriptor); + methodDescriptors.add(getCaPoolMethodDescriptor); + methodDescriptors.add(listCaPoolsMethodDescriptor); + methodDescriptors.add(deleteCaPoolMethodDescriptor); + methodDescriptors.add(fetchCaCertsMethodDescriptor); + methodDescriptors.add(getCertificateRevocationListMethodDescriptor); + methodDescriptors.add(listCertificateRevocationListsMethodDescriptor); + methodDescriptors.add(updateCertificateRevocationListMethodDescriptor); + methodDescriptors.add(createCertificateTemplateMethodDescriptor); + methodDescriptors.add(deleteCertificateTemplateMethodDescriptor); + methodDescriptors.add(getCertificateTemplateMethodDescriptor); + methodDescriptors.add(listCertificateTemplatesMethodDescriptor); + methodDescriptors.add(updateCertificateTemplateMethodDescriptor); + methodDescriptors.add(listLocationsMethodDescriptor); + methodDescriptors.add(getLocationMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createCertificateCallable() { + return createCertificateCallable; + } + + @Override + public UnaryCallable getCertificateCallable() { + return getCertificateCallable; + } + + @Override + public UnaryCallable + listCertificatesCallable() { + return listCertificatesCallable; + } + + @Override + public UnaryCallable + listCertificatesPagedCallable() { + return listCertificatesPagedCallable; + } + + @Override + public UnaryCallable revokeCertificateCallable() { + return revokeCertificateCallable; + } + + @Override + public UnaryCallable updateCertificateCallable() { + return updateCertificateCallable; + } + + @Override + public UnaryCallable + activateCertificateAuthorityCallable() { + return activateCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + ActivateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + activateCertificateAuthorityOperationCallable() { + return activateCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + createCertificateAuthorityCallable() { + return createCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + CreateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + createCertificateAuthorityOperationCallable() { + return createCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + disableCertificateAuthorityCallable() { + return disableCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + DisableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + disableCertificateAuthorityOperationCallable() { + return disableCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + enableCertificateAuthorityCallable() { + return enableCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + EnableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + enableCertificateAuthorityOperationCallable() { + return enableCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + fetchCertificateAuthorityCsrCallable() { + return fetchCertificateAuthorityCsrCallable; + } + + @Override + public UnaryCallable + getCertificateAuthorityCallable() { + return getCertificateAuthorityCallable; + } + + @Override + public UnaryCallable + listCertificateAuthoritiesCallable() { + return listCertificateAuthoritiesCallable; + } + + @Override + public UnaryCallable + listCertificateAuthoritiesPagedCallable() { + return listCertificateAuthoritiesPagedCallable; + } + + @Override + public UnaryCallable + undeleteCertificateAuthorityCallable() { + return undeleteCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + UndeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + undeleteCertificateAuthorityOperationCallable() { + return undeleteCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + deleteCertificateAuthorityCallable() { + return deleteCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + DeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + deleteCertificateAuthorityOperationCallable() { + return deleteCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + updateCertificateAuthorityCallable() { + return updateCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + UpdateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + updateCertificateAuthorityOperationCallable() { + return updateCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable createCaPoolCallable() { + return createCaPoolCallable; + } + + @Override + public OperationCallable + createCaPoolOperationCallable() { + return createCaPoolOperationCallable; + } + + @Override + public UnaryCallable updateCaPoolCallable() { + return updateCaPoolCallable; + } + + @Override + public OperationCallable + updateCaPoolOperationCallable() { + return updateCaPoolOperationCallable; + } + + @Override + public UnaryCallable getCaPoolCallable() { + return getCaPoolCallable; + } + + @Override + public UnaryCallable listCaPoolsCallable() { + return listCaPoolsCallable; + } + + @Override + public UnaryCallable listCaPoolsPagedCallable() { + return listCaPoolsPagedCallable; + } + + @Override + public UnaryCallable deleteCaPoolCallable() { + return deleteCaPoolCallable; + } + + @Override + public OperationCallable + deleteCaPoolOperationCallable() { + return deleteCaPoolOperationCallable; + } + + @Override + public UnaryCallable fetchCaCertsCallable() { + return fetchCaCertsCallable; + } + + @Override + public UnaryCallable + getCertificateRevocationListCallable() { + return getCertificateRevocationListCallable; + } + + @Override + public UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsCallable() { + return listCertificateRevocationListsCallable; + } + + @Override + public UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsPagedResponse> + listCertificateRevocationListsPagedCallable() { + return listCertificateRevocationListsPagedCallable; + } + + @Override + public UnaryCallable + updateCertificateRevocationListCallable() { + return updateCertificateRevocationListCallable; + } + + @Override + public OperationCallable< + UpdateCertificateRevocationListRequest, CertificateRevocationList, OperationMetadata> + updateCertificateRevocationListOperationCallable() { + return updateCertificateRevocationListOperationCallable; + } + + @Override + public UnaryCallable + createCertificateTemplateCallable() { + return createCertificateTemplateCallable; + } + + @Override + public OperationCallable + createCertificateTemplateOperationCallable() { + return createCertificateTemplateOperationCallable; + } + + @Override + public UnaryCallable + deleteCertificateTemplateCallable() { + return deleteCertificateTemplateCallable; + } + + @Override + public OperationCallable + deleteCertificateTemplateOperationCallable() { + return deleteCertificateTemplateOperationCallable; + } + + @Override + public UnaryCallable + getCertificateTemplateCallable() { + return getCertificateTemplateCallable; + } + + @Override + public UnaryCallable + listCertificateTemplatesCallable() { + return listCertificateTemplatesCallable; + } + + @Override + public UnaryCallable + listCertificateTemplatesPagedCallable() { + return listCertificateTemplatesPagedCallable; + } + + @Override + public UnaryCallable + updateCertificateTemplateCallable() { + return updateCertificateTemplateCallable; + } + + @Override + public OperationCallable + updateCertificateTemplateOperationCallable() { + return updateCertificateTemplateOperationCallable; + } + + @Override + public UnaryCallable listLocationsCallable() { + return listLocationsCallable; + } + + @Override + public UnaryCallable + listLocationsPagedCallable() { + return listLocationsPagedCallable; + } + + @Override + public UnaryCallable getLocationCallable() { + return getLocationCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @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-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClient.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClient.java index 5491c185..59c72359 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClient.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClient.java @@ -20,6 +20,7 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; @@ -31,7 +32,6 @@ import com.google.cloud.security.privateca.v1beta1.stub.CertificateAuthorityServiceStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.FieldMask; import java.io.IOException; import java.util.List; @@ -112,6 +112,22 @@ * CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); * } * + *

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.
+ * CertificateAuthorityServiceSettings certificateAuthorityServiceSettings =
+ *     CertificateAuthorityServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder()
+ *                 .build())
+ *         .build();
+ * CertificateAuthorityServiceClient certificateAuthorityServiceClient =
+ *     CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -119,7 +135,8 @@ public class CertificateAuthorityServiceClient implements BackgroundResource { private final CertificateAuthorityServiceSettings settings; private final CertificateAuthorityServiceStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of CertificateAuthorityServiceClient with default settings. */ public static final CertificateAuthorityServiceClient create() throws IOException { @@ -154,13 +171,17 @@ protected CertificateAuthorityServiceClient(CertificateAuthorityServiceSettings throws IOException { this.settings = settings; this.stub = ((CertificateAuthorityServiceStubSettings) 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 CertificateAuthorityServiceClient(CertificateAuthorityServiceStub 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 CertificateAuthorityServiceSettings getSettings() { @@ -175,10 +196,18 @@ public CertificateAuthorityServiceStub 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. /** * Create a new [Certificate][google.cloud.security.privateca.v1beta1.Certificate] in a given diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceSettings.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceSettings.java index 2ce6295b..ca948f34 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceSettings.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceSettings.java @@ -26,6 +26,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; @@ -310,11 +311,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return CertificateAuthorityServiceStubSettings.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 CertificateAuthorityServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return CertificateAuthorityServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return CertificateAuthorityServiceStubSettings.defaultTransportChannelProvider(); } @@ -324,11 +332,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return CertificateAuthorityServiceStubSettings.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); @@ -367,6 +381,11 @@ private static Builder createDefault() { return new Builder(CertificateAuthorityServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(CertificateAuthorityServiceStubSettings.newHttpJsonBuilder()); + } + public CertificateAuthorityServiceStubSettings.Builder getStubSettingsBuilder() { return ((CertificateAuthorityServiceStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStub.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStub.java index e36206f8..3f576733 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStub.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStub.java @@ -70,7 +70,11 @@ public abstract class CertificateAuthorityServiceStub 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 createCertificateCallable() { diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStubSettings.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStubSettings.java index 0b9ff6f8..8531f27a 100644 --- a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStubSettings.java +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/CertificateAuthorityServiceStubSettings.java @@ -31,6 +31,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; @@ -665,6 +668,11 @@ public CertificateAuthorityServiceStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcCertificateAuthorityServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonCertificateAuthorityServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -697,18 +705,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(CertificateAuthorityServiceStubSettings.class)) @@ -716,11 +731,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(CertificateAuthorityServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CertificateAuthorityServiceStubSettings.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); @@ -1048,6 +1082,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 .createCertificateSettings() diff --git a/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.java new file mode 100644 index 00000000..22c63164 --- /dev/null +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceCallableFactory.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.security.privateca.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the CertificateAuthorityService service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonCertificateAuthorityServiceCallableFactory + 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-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceStub.java b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceStub.java new file mode 100644 index 00000000..ccd015e3 --- /dev/null +++ b/google-cloud-security-private-ca/src/main/java/com/google/cloud/security/privateca/v1beta1/stub/HttpJsonCertificateAuthorityServiceStub.java @@ -0,0 +1,1559 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.stub; + +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificateAuthoritiesPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificateRevocationListsPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificatesPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListReusableConfigsPagedResponse; + +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.security.privateca.v1beta1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest; +import com.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse; +import com.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRequest; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest; +import com.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesResponse; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest; +import com.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest; +import com.google.longrunning.Operation; +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 CertificateAuthorityService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonCertificateAuthorityServiceStub extends CertificateAuthorityServiceStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(CertificateAuthority.getDescriptor()) + .add(OperationMetadata.getDescriptor()) + .add(CertificateRevocationList.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates", + 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, "certificateId", request.getCertificateId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificate") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}", + 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(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listCertificatesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificates") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificates", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificatesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + revokeCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RevokeCertificate") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificates/*}:revoke", + 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(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCertificateMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificate") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{certificate.name=projects/*/locations/*/certificateAuthorities/*/certificates/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "certificate.name", request.getCertificate().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("certificate", request.getCertificate())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Certificate.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + activateCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ActivateCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}: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( + (ActivateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/CreateCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities", + 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, + "certificateAuthorityId", + request.getCertificateAuthorityId()); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateAuthority", request.getCertificateAuthority())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + disableCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/DisableCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:disable", + 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( + (DisableCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + enableCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/EnableCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:enable", + 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( + (EnableCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + FetchCertificateAuthorityCsrRequest, FetchCertificateAuthorityCsrResponse> + fetchCertificateAuthorityCsrMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/FetchCertificateAuthorityCsr") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:fetch", + 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(FetchCertificateAuthorityCsrResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateAuthority") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}", + 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(CertificateAuthority.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateAuthoritiesRequest, ListCertificateAuthoritiesResponse> + listCertificateAuthoritiesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateAuthorities") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/certificateAuthorities", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCertificateAuthoritiesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + restoreCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/RestoreCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:restore", + 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( + (RestoreCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + scheduleDeleteCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ScheduleDeleteCertificateAuthority") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*}:scheduleDelete", + 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( + (ScheduleDeleteCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateCertificateAuthorityMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateAuthority") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{certificateAuthority.name=projects/*/locations/*/certificateAuthorities/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateAuthority.name", + request.getCertificateAuthority().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateAuthority", request.getCertificateAuthority())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateAuthorityRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor< + GetCertificateRevocationListRequest, CertificateRevocationList> + getCertificateRevocationListMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetCertificateRevocationList") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}", + 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(CertificateRevocationList.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListCertificateRevocationLists") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*/certificateAuthorities/*}/certificateRevocationLists", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListCertificateRevocationListsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCertificateRevocationListMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/UpdateCertificateRevocationList") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{certificateRevocationList.name=projects/*/locations/*/certificateAuthorities/*/certificateRevocationLists/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "certificateRevocationList.name", + request.getCertificateRevocationList().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "requestId", request.getRequestId()); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "certificateRevocationList", + request.getCertificateRevocationList())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateCertificateRevocationListRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getReusableConfigMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/GetReusableConfig") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{name=projects/*/locations/*/reusableConfigs/*}", + 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(ReusableConfig.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listReusableConfigsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.security.privateca.v1beta1.CertificateAuthorityService/ListReusableConfigs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{parent=projects/*/locations/*}/reusableConfigs", + 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, "orderBy", request.getOrderBy()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListReusableConfigsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createCertificateCallable; + private final UnaryCallable getCertificateCallable; + private final UnaryCallable + listCertificatesCallable; + private final UnaryCallable + listCertificatesPagedCallable; + private final UnaryCallable revokeCertificateCallable; + private final UnaryCallable updateCertificateCallable; + private final UnaryCallable + activateCertificateAuthorityCallable; + private final OperationCallable< + ActivateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + activateCertificateAuthorityOperationCallable; + private final UnaryCallable + createCertificateAuthorityCallable; + private final OperationCallable< + CreateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + createCertificateAuthorityOperationCallable; + private final UnaryCallable + disableCertificateAuthorityCallable; + private final OperationCallable< + DisableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + disableCertificateAuthorityOperationCallable; + private final UnaryCallable + enableCertificateAuthorityCallable; + private final OperationCallable< + EnableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + enableCertificateAuthorityOperationCallable; + private final UnaryCallable< + FetchCertificateAuthorityCsrRequest, FetchCertificateAuthorityCsrResponse> + fetchCertificateAuthorityCsrCallable; + private final UnaryCallable + getCertificateAuthorityCallable; + private final UnaryCallable + listCertificateAuthoritiesCallable; + private final UnaryCallable< + ListCertificateAuthoritiesRequest, ListCertificateAuthoritiesPagedResponse> + listCertificateAuthoritiesPagedCallable; + private final UnaryCallable + restoreCertificateAuthorityCallable; + private final OperationCallable< + RestoreCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + restoreCertificateAuthorityOperationCallable; + private final UnaryCallable + scheduleDeleteCertificateAuthorityCallable; + private final OperationCallable< + ScheduleDeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + scheduleDeleteCertificateAuthorityOperationCallable; + private final UnaryCallable + updateCertificateAuthorityCallable; + private final OperationCallable< + UpdateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + updateCertificateAuthorityOperationCallable; + private final UnaryCallable + getCertificateRevocationListCallable; + private final UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsCallable; + private final UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsPagedResponse> + listCertificateRevocationListsPagedCallable; + private final UnaryCallable + updateCertificateRevocationListCallable; + private final OperationCallable< + UpdateCertificateRevocationListRequest, CertificateRevocationList, OperationMetadata> + updateCertificateRevocationListOperationCallable; + private final UnaryCallable getReusableConfigCallable; + private final UnaryCallable + listReusableConfigsCallable; + private final UnaryCallable + listReusableConfigsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonCertificateAuthorityServiceStub create( + CertificateAuthorityServiceStubSettings settings) throws IOException { + return new HttpJsonCertificateAuthorityServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonCertificateAuthorityServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonCertificateAuthorityServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonCertificateAuthorityServiceStub, 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 HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonCertificateAuthorityServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonCertificateAuthorityServiceStub, 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 HttpJsonCertificateAuthorityServiceStub( + CertificateAuthorityServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificatesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCertificatesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings revokeCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(revokeCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateCertificateTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + activateCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(activateCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + disableCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(disableCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + enableCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(enableCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + fetchCertificateAuthorityCsrTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(fetchCertificateAuthorityCsrMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCertificateAuthoritiesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCertificateAuthoritiesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + restoreCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(restoreCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + scheduleDeleteCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(scheduleDeleteCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateAuthorityTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateAuthorityMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCertificateRevocationListTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getCertificateRevocationListMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listCertificateRevocationListsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCertificateRevocationListTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCertificateRevocationListMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getReusableConfigTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getReusableConfigMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listReusableConfigsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listReusableConfigsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createCertificateCallable = + callableFactory.createUnaryCallable( + createCertificateTransportSettings, + settings.createCertificateSettings(), + clientContext); + this.getCertificateCallable = + callableFactory.createUnaryCallable( + getCertificateTransportSettings, settings.getCertificateSettings(), clientContext); + this.listCertificatesCallable = + callableFactory.createUnaryCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.listCertificatesPagedCallable = + callableFactory.createPagedCallable( + listCertificatesTransportSettings, settings.listCertificatesSettings(), clientContext); + this.revokeCertificateCallable = + callableFactory.createUnaryCallable( + revokeCertificateTransportSettings, + settings.revokeCertificateSettings(), + clientContext); + this.updateCertificateCallable = + callableFactory.createUnaryCallable( + updateCertificateTransportSettings, + settings.updateCertificateSettings(), + clientContext); + this.activateCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + activateCertificateAuthorityTransportSettings, + settings.activateCertificateAuthoritySettings(), + clientContext); + this.activateCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + activateCertificateAuthorityTransportSettings, + settings.activateCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + createCertificateAuthorityTransportSettings, + settings.createCertificateAuthoritySettings(), + clientContext); + this.createCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + createCertificateAuthorityTransportSettings, + settings.createCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.disableCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + disableCertificateAuthorityTransportSettings, + settings.disableCertificateAuthoritySettings(), + clientContext); + this.disableCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + disableCertificateAuthorityTransportSettings, + settings.disableCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.enableCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + enableCertificateAuthorityTransportSettings, + settings.enableCertificateAuthoritySettings(), + clientContext); + this.enableCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + enableCertificateAuthorityTransportSettings, + settings.enableCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.fetchCertificateAuthorityCsrCallable = + callableFactory.createUnaryCallable( + fetchCertificateAuthorityCsrTransportSettings, + settings.fetchCertificateAuthorityCsrSettings(), + clientContext); + this.getCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + getCertificateAuthorityTransportSettings, + settings.getCertificateAuthoritySettings(), + clientContext); + this.listCertificateAuthoritiesCallable = + callableFactory.createUnaryCallable( + listCertificateAuthoritiesTransportSettings, + settings.listCertificateAuthoritiesSettings(), + clientContext); + this.listCertificateAuthoritiesPagedCallable = + callableFactory.createPagedCallable( + listCertificateAuthoritiesTransportSettings, + settings.listCertificateAuthoritiesSettings(), + clientContext); + this.restoreCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + restoreCertificateAuthorityTransportSettings, + settings.restoreCertificateAuthoritySettings(), + clientContext); + this.restoreCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + restoreCertificateAuthorityTransportSettings, + settings.restoreCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.scheduleDeleteCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + scheduleDeleteCertificateAuthorityTransportSettings, + settings.scheduleDeleteCertificateAuthoritySettings(), + clientContext); + this.scheduleDeleteCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + scheduleDeleteCertificateAuthorityTransportSettings, + settings.scheduleDeleteCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateCertificateAuthorityCallable = + callableFactory.createUnaryCallable( + updateCertificateAuthorityTransportSettings, + settings.updateCertificateAuthoritySettings(), + clientContext); + this.updateCertificateAuthorityOperationCallable = + callableFactory.createOperationCallable( + updateCertificateAuthorityTransportSettings, + settings.updateCertificateAuthorityOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getCertificateRevocationListCallable = + callableFactory.createUnaryCallable( + getCertificateRevocationListTransportSettings, + settings.getCertificateRevocationListSettings(), + clientContext); + this.listCertificateRevocationListsCallable = + callableFactory.createUnaryCallable( + listCertificateRevocationListsTransportSettings, + settings.listCertificateRevocationListsSettings(), + clientContext); + this.listCertificateRevocationListsPagedCallable = + callableFactory.createPagedCallable( + listCertificateRevocationListsTransportSettings, + settings.listCertificateRevocationListsSettings(), + clientContext); + this.updateCertificateRevocationListCallable = + callableFactory.createUnaryCallable( + updateCertificateRevocationListTransportSettings, + settings.updateCertificateRevocationListSettings(), + clientContext); + this.updateCertificateRevocationListOperationCallable = + callableFactory.createOperationCallable( + updateCertificateRevocationListTransportSettings, + settings.updateCertificateRevocationListOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getReusableConfigCallable = + callableFactory.createUnaryCallable( + getReusableConfigTransportSettings, + settings.getReusableConfigSettings(), + clientContext); + this.listReusableConfigsCallable = + callableFactory.createUnaryCallable( + listReusableConfigsTransportSettings, + settings.listReusableConfigsSettings(), + clientContext); + this.listReusableConfigsPagedCallable = + callableFactory.createPagedCallable( + listReusableConfigsTransportSettings, + settings.listReusableConfigsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createCertificateMethodDescriptor); + methodDescriptors.add(getCertificateMethodDescriptor); + methodDescriptors.add(listCertificatesMethodDescriptor); + methodDescriptors.add(revokeCertificateMethodDescriptor); + methodDescriptors.add(updateCertificateMethodDescriptor); + methodDescriptors.add(activateCertificateAuthorityMethodDescriptor); + methodDescriptors.add(createCertificateAuthorityMethodDescriptor); + methodDescriptors.add(disableCertificateAuthorityMethodDescriptor); + methodDescriptors.add(enableCertificateAuthorityMethodDescriptor); + methodDescriptors.add(fetchCertificateAuthorityCsrMethodDescriptor); + methodDescriptors.add(getCertificateAuthorityMethodDescriptor); + methodDescriptors.add(listCertificateAuthoritiesMethodDescriptor); + methodDescriptors.add(restoreCertificateAuthorityMethodDescriptor); + methodDescriptors.add(scheduleDeleteCertificateAuthorityMethodDescriptor); + methodDescriptors.add(updateCertificateAuthorityMethodDescriptor); + methodDescriptors.add(getCertificateRevocationListMethodDescriptor); + methodDescriptors.add(listCertificateRevocationListsMethodDescriptor); + methodDescriptors.add(updateCertificateRevocationListMethodDescriptor); + methodDescriptors.add(getReusableConfigMethodDescriptor); + methodDescriptors.add(listReusableConfigsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createCertificateCallable() { + return createCertificateCallable; + } + + @Override + public UnaryCallable getCertificateCallable() { + return getCertificateCallable; + } + + @Override + public UnaryCallable + listCertificatesCallable() { + return listCertificatesCallable; + } + + @Override + public UnaryCallable + listCertificatesPagedCallable() { + return listCertificatesPagedCallable; + } + + @Override + public UnaryCallable revokeCertificateCallable() { + return revokeCertificateCallable; + } + + @Override + public UnaryCallable updateCertificateCallable() { + return updateCertificateCallable; + } + + @Override + public UnaryCallable + activateCertificateAuthorityCallable() { + return activateCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + ActivateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + activateCertificateAuthorityOperationCallable() { + return activateCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + createCertificateAuthorityCallable() { + return createCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + CreateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + createCertificateAuthorityOperationCallable() { + return createCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + disableCertificateAuthorityCallable() { + return disableCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + DisableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + disableCertificateAuthorityOperationCallable() { + return disableCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + enableCertificateAuthorityCallable() { + return enableCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + EnableCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + enableCertificateAuthorityOperationCallable() { + return enableCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + fetchCertificateAuthorityCsrCallable() { + return fetchCertificateAuthorityCsrCallable; + } + + @Override + public UnaryCallable + getCertificateAuthorityCallable() { + return getCertificateAuthorityCallable; + } + + @Override + public UnaryCallable + listCertificateAuthoritiesCallable() { + return listCertificateAuthoritiesCallable; + } + + @Override + public UnaryCallable + listCertificateAuthoritiesPagedCallable() { + return listCertificateAuthoritiesPagedCallable; + } + + @Override + public UnaryCallable + restoreCertificateAuthorityCallable() { + return restoreCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + RestoreCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + restoreCertificateAuthorityOperationCallable() { + return restoreCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + scheduleDeleteCertificateAuthorityCallable() { + return scheduleDeleteCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + ScheduleDeleteCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + scheduleDeleteCertificateAuthorityOperationCallable() { + return scheduleDeleteCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + updateCertificateAuthorityCallable() { + return updateCertificateAuthorityCallable; + } + + @Override + public OperationCallable< + UpdateCertificateAuthorityRequest, CertificateAuthority, OperationMetadata> + updateCertificateAuthorityOperationCallable() { + return updateCertificateAuthorityOperationCallable; + } + + @Override + public UnaryCallable + getCertificateRevocationListCallable() { + return getCertificateRevocationListCallable; + } + + @Override + public UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsResponse> + listCertificateRevocationListsCallable() { + return listCertificateRevocationListsCallable; + } + + @Override + public UnaryCallable< + ListCertificateRevocationListsRequest, ListCertificateRevocationListsPagedResponse> + listCertificateRevocationListsPagedCallable() { + return listCertificateRevocationListsPagedCallable; + } + + @Override + public UnaryCallable + updateCertificateRevocationListCallable() { + return updateCertificateRevocationListCallable; + } + + @Override + public OperationCallable< + UpdateCertificateRevocationListRequest, CertificateRevocationList, OperationMetadata> + updateCertificateRevocationListOperationCallable() { + return updateCertificateRevocationListOperationCallable; + } + + @Override + public UnaryCallable getReusableConfigCallable() { + return getReusableConfigCallable; + } + + @Override + public UnaryCallable + listReusableConfigsCallable() { + return listReusableConfigsCallable; + } + + @Override + public UnaryCallable + listReusableConfigsPagedCallable() { + return listReusableConfigsPagedCallable; + } + + @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-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClientHttpJsonTest.java b/google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClientHttpJsonTest.java new file mode 100644 index 00000000..9d04a3ee --- /dev/null +++ b/google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1/CertificateAuthorityServiceClientHttpJsonTest.java @@ -0,0 +1,3653 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1; + +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCaPoolsPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateAuthoritiesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateRevocationListsPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificateTemplatesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListCertificatesPagedResponse; +import static com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient.ListLocationsPagedResponse; + +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.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.stub.HttpJsonCertificateAuthorityServiceStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.Duration; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class CertificateAuthorityServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static CertificateAuthorityServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonCertificateAuthorityServiceStub.getMethodDescriptors(), + CertificateAuthorityServiceSettings.getDefaultEndpoint()); + CertificateAuthorityServiceSettings settings = + CertificateAuthorityServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CertificateAuthorityServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = client.createCertificate(parent, certificate, certificateId); + 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 createCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificate(parent, certificate, certificateId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = client.createCertificate(parent, certificate, certificateId); + 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 createCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificate(parent, certificate, certificateId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1351/locations/location-1351/caPools/caPool-1351/certificates/certificate-1351"; + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1351/locations/location-1351/caPools/caPool-1351/certificates/certificate-1351"; + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificatesTest() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + client.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificatesTest2() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + client.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void revokeCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + + Certificate actualResponse = client.revokeCertificate(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 revokeCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + client.revokeCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void revokeCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-1351/locations/location-1351/caPools/caPool-1351/certificates/certificate-1351"; + + Certificate actualResponse = client.revokeCertificate(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 revokeCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-1351/locations/location-1351/caPools/caPool-1351/certificates/certificate-1351"; + client.revokeCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + Certificate certificate = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Certificate actualResponse = client.updateCertificate(certificate, updateMask); + 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 updateCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Certificate certificate = + Certificate.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setIssuerCertificateAuthority( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setCertificateTemplate( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setSubjectMode(SubjectRequestMode.forNumber(0)) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificate(certificate, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void activateCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("activateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.activateCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void activateCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.activateCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void activateCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("activateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.activateCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void activateCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.activateCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + + CertificateAuthority actualResponse = + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .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 createCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + + CertificateAuthority actualResponse = + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .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 createCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void disableCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("disableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.disableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void disableCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.disableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void disableCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("disableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.disableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void disableCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.disableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void enableCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("enableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.enableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void enableCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.enableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void enableCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("enableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.enableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void enableCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.enableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void fetchCertificateAuthorityCsrTest() throws Exception { + FetchCertificateAuthorityCsrResponse expectedResponse = + FetchCertificateAuthorityCsrResponse.newBuilder().setPemCsr("pemCsr-991911478").build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + FetchCertificateAuthorityCsrResponse actualResponse = client.fetchCertificateAuthorityCsr(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 fetchCertificateAuthorityCsrExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.fetchCertificateAuthorityCsr(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchCertificateAuthorityCsrTest2() throws Exception { + FetchCertificateAuthorityCsrResponse expectedResponse = + FetchCertificateAuthorityCsrResponse.newBuilder().setPemCsr("pemCsr-991911478").build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + FetchCertificateAuthorityCsrResponse actualResponse = client.fetchCertificateAuthorityCsr(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 fetchCertificateAuthorityCsrExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.fetchCertificateAuthorityCsr(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.getCertificateAuthority(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 getCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.getCertificateAuthority(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.getCertificateAuthority(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 getCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.getCertificateAuthority(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateAuthoritiesTest() throws Exception { + CertificateAuthority responsesElement = CertificateAuthority.newBuilder().build(); + ListCertificateAuthoritiesResponse expectedResponse = + ListCertificateAuthoritiesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateAuthorities(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + + ListCertificateAuthoritiesPagedResponse pagedListResponse = + client.listCertificateAuthorities(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateAuthoritiesList().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 listCertificateAuthoritiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + client.listCertificateAuthorities(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateAuthoritiesTest2() throws Exception { + CertificateAuthority responsesElement = CertificateAuthority.newBuilder().build(); + ListCertificateAuthoritiesResponse expectedResponse = + ListCertificateAuthoritiesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateAuthorities(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + + ListCertificateAuthoritiesPagedResponse pagedListResponse = + client.listCertificateAuthorities(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateAuthoritiesList().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 listCertificateAuthoritiesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-6494/locations/location-6494/caPools/caPool-6494"; + client.listCertificateAuthorities(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void undeleteCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.undeleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.undeleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.undeleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.undeleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.deleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.deleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + + CertificateAuthority actualResponse = client.deleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-6987/locations/location-6987/caPools/caPool-6987/certificateAuthorities/certificateAuthoritie-6987"; + client.deleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthority certificateAuthority = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateAuthority actualResponse = + client.updateCertificateAuthorityAsync(certificateAuthority, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthority certificateAuthority = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateAuthorityAsync(certificateAuthority, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCaPoolTest() throws Exception { + CaPool expectedResponse = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCaPoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + + CaPool actualResponse = client.createCaPoolAsync(parent, caPool, caPoolId).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 createCaPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + client.createCaPoolAsync(parent, caPool, caPoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCaPoolTest2() throws Exception { + CaPool expectedResponse = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCaPoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + + CaPool actualResponse = client.createCaPoolAsync(parent, caPool, caPoolId).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 createCaPoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + client.createCaPoolAsync(parent, caPool, caPoolId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCaPoolTest() throws Exception { + CaPool expectedResponse = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCaPoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CaPool caPool = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CaPool actualResponse = client.updateCaPoolAsync(caPool, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCaPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPool caPool = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCaPoolAsync(caPool, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getCaPoolTest() throws Exception { + CaPool expectedResponse = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + + CaPool actualResponse = client.getCaPool(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 getCaPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + client.getCaPool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCaPoolTest2() throws Exception { + CaPool expectedResponse = + CaPool.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setIssuancePolicy(CaPool.IssuancePolicy.newBuilder().build()) + .setPublishingOptions(CaPool.PublishingOptions.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2703/locations/location-2703/caPools/caPool-2703"; + + CaPool actualResponse = client.getCaPool(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 getCaPoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2703/locations/location-2703/caPools/caPool-2703"; + client.getCaPool(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCaPoolsTest() throws Exception { + CaPool responsesElement = CaPool.newBuilder().build(); + ListCaPoolsResponse expectedResponse = + ListCaPoolsResponse.newBuilder() + .setNextPageToken("") + .addAllCaPools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCaPoolsPagedResponse pagedListResponse = client.listCaPools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCaPoolsList().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 listCaPoolsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCaPools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCaPoolsTest2() throws Exception { + CaPool responsesElement = CaPool.newBuilder().build(); + ListCaPoolsResponse expectedResponse = + ListCaPoolsResponse.newBuilder() + .setNextPageToken("") + .addAllCaPools(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCaPoolsPagedResponse pagedListResponse = client.listCaPools(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCaPoolsList().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 listCaPoolsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listCaPools(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteCaPoolTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCaPoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + + client.deleteCaPoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCaPoolExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + client.deleteCaPoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCaPoolTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCaPoolTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-2703/locations/location-2703/caPools/caPool-2703"; + + client.deleteCaPoolAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCaPoolExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2703/locations/location-2703/caPools/caPool-2703"; + client.deleteCaPoolAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void fetchCaCertsTest() throws Exception { + FetchCaCertsResponse expectedResponse = + FetchCaCertsResponse.newBuilder() + .addAllCaCerts(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CaPoolName caPool = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + + FetchCaCertsResponse actualResponse = client.fetchCaCerts(caPool); + 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 fetchCaCertsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CaPoolName caPool = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + client.fetchCaCerts(caPool); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchCaCertsTest2() throws Exception { + FetchCaCertsResponse expectedResponse = + FetchCaCertsResponse.newBuilder() + .addAllCaCerts(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String caPool = "projects/project-9774/locations/location-9774/caPools/caPool-9774"; + + FetchCaCertsResponse actualResponse = client.fetchCaCerts(caPool); + 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 fetchCaCertsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String caPool = "projects/project-9774/locations/location-9774/caPools/caPool-9774"; + client.fetchCaCerts(caPool); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateRevocationListTest() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]"); + + CertificateRevocationList actualResponse = client.getCertificateRevocationList(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 getCertificateRevocationListExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]"); + client.getCertificateRevocationList(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateRevocationListTest2() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-4203/locations/location-4203/caPools/caPool-4203/certificateAuthorities/certificateAuthoritie-4203/certificateRevocationLists/certificateRevocationList-4203"; + + CertificateRevocationList actualResponse = client.getCertificateRevocationList(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 getCertificateRevocationListExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-4203/locations/location-4203/caPools/caPool-4203/certificateAuthorities/certificateAuthoritie-4203/certificateRevocationLists/certificateRevocationList-4203"; + client.getCertificateRevocationList(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateRevocationListsTest() throws Exception { + CertificateRevocationList responsesElement = CertificateRevocationList.newBuilder().build(); + ListCertificateRevocationListsResponse expectedResponse = + ListCertificateRevocationListsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateRevocationLists(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName parent = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + + ListCertificateRevocationListsPagedResponse pagedListResponse = + client.listCertificateRevocationLists(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCertificateRevocationListsList().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 listCertificateRevocationListsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName parent = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + client.listCertificateRevocationLists(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateRevocationListsTest2() throws Exception { + CertificateRevocationList responsesElement = CertificateRevocationList.newBuilder().build(); + ListCertificateRevocationListsResponse expectedResponse = + ListCertificateRevocationListsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateRevocationLists(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-6570/locations/location-6570/caPools/caPool-6570/certificateAuthorities/certificateAuthoritie-6570"; + + ListCertificateRevocationListsPagedResponse pagedListResponse = + client.listCertificateRevocationLists(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCertificateRevocationListsList().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 listCertificateRevocationListsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-6570/locations/location-6570/caPools/caPool-6570/certificateAuthorities/certificateAuthoritie-6570"; + client.listCertificateRevocationLists(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCertificateRevocationListTest() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateRevocationListTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateRevocationList actualResponse = + client.updateCertificateRevocationListAsync(certificateRevocationList, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCertificateRevocationListExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setRevisionId("revisionId-1507445162") + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateRevocationListAsync(certificateRevocationList, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateTemplateTest() throws Exception { + CertificateTemplate expectedResponse = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateTemplateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + + CertificateTemplate actualResponse = + client + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .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 createCertificateTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + client + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateTemplateTest2() throws Exception { + CertificateTemplate expectedResponse = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateTemplateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + + CertificateTemplate actualResponse = + client + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .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 createCertificateTemplateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + client + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateTemplateTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateTemplateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + + client.deleteCertificateTemplateAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCertificateTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + client.deleteCertificateTemplateAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteCertificateTemplateTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteCertificateTemplateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5118/locations/location-5118/certificateTemplates/certificateTemplate-5118"; + + client.deleteCertificateTemplateAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteCertificateTemplateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5118/locations/location-5118/certificateTemplates/certificateTemplate-5118"; + client.deleteCertificateTemplateAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getCertificateTemplateTest() throws Exception { + CertificateTemplate expectedResponse = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + + CertificateTemplate actualResponse = client.getCertificateTemplate(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 getCertificateTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + client.getCertificateTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTemplateTest2() throws Exception { + CertificateTemplate expectedResponse = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-5118/locations/location-5118/certificateTemplates/certificateTemplate-5118"; + + CertificateTemplate actualResponse = client.getCertificateTemplate(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 getCertificateTemplateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5118/locations/location-5118/certificateTemplates/certificateTemplate-5118"; + client.getCertificateTemplate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateTemplatesTest() throws Exception { + CertificateTemplate responsesElement = CertificateTemplate.newBuilder().build(); + ListCertificateTemplatesResponse expectedResponse = + ListCertificateTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateTemplates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCertificateTemplatesPagedResponse pagedListResponse = + client.listCertificateTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateTemplatesList().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 listCertificateTemplatesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCertificateTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateTemplatesTest2() throws Exception { + CertificateTemplate responsesElement = CertificateTemplate.newBuilder().build(); + ListCertificateTemplatesResponse expectedResponse = + ListCertificateTemplatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateTemplates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCertificateTemplatesPagedResponse pagedListResponse = + client.listCertificateTemplates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateTemplatesList().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 listCertificateTemplatesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listCertificateTemplates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCertificateTemplateTest() throws Exception { + CertificateTemplate expectedResponse = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateTemplateTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateTemplate certificateTemplate = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateTemplate actualResponse = + client.updateCertificateTemplateAsync(certificateTemplate, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCertificateTemplateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateTemplate certificateTemplate = + CertificateTemplate.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setPredefinedValues(X509Parameters.newBuilder().build()) + .setIdentityConstraints(CertificateIdentityConstraints.newBuilder().build()) + .setPassthroughExtensions(CertificateExtensionConstraints.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateTemplateAsync(certificateTemplate, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listLocationsTest() throws Exception { + Location responsesElement = Location.newBuilder().build(); + ListLocationsResponse expectedResponse = + ListLocationsResponse.newBuilder() + .setNextPageToken("") + .addAllLocations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListLocationsPagedResponse pagedListResponse = client.listLocations(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getLocationsList().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 listLocationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("projects/project-3664") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listLocations(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getLocationTest() throws Exception { + Location expectedResponse = + Location.newBuilder() + .setName("name3373707") + .setLocationId("locationId1541836720") + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .setMetadata(Any.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + + Location actualResponse = client.getLocation(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 getLocationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetLocationRequest request = + GetLocationRequest.newBuilder() + .setName("projects/project-9062/locations/location-9062") + .build(); + client.getLocation(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(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 setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(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 getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(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 testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClientHttpJsonTest.java b/google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClientHttpJsonTest.java new file mode 100644 index 00000000..4932c05f --- /dev/null +++ b/google-cloud-security-private-ca/src/test/java/com/google/cloud/security/privateca/v1beta1/CertificateAuthorityServiceClientHttpJsonTest.java @@ -0,0 +1,2420 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1; + +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificateAuthoritiesPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificateRevocationListsPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListCertificatesPagedResponse; +import static com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient.ListReusableConfigsPagedResponse; + +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.security.privateca.v1beta1.stub.HttpJsonCertificateAuthorityServiceStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Duration; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class CertificateAuthorityServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static CertificateAuthorityServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonCertificateAuthorityServiceStub.getMethodDescriptors(), + CertificateAuthorityServiceSettings.getDefaultEndpoint()); + CertificateAuthorityServiceSettings settings = + CertificateAuthorityServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CertificateAuthorityServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = client.createCertificate(parent, certificate, certificateId); + 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 createCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificate(parent, certificate, certificateId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + + Certificate actualResponse = client.createCertificate(parent, certificate, certificateId); + 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 createCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + client.createCertificate(parent, certificate, certificateId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-8612/locations/location-8612/certificateAuthorities/certificateAuthoritie-8612/certificates/certificate-8612"; + + Certificate actualResponse = client.getCertificate(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 getCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-8612/locations/location-8612/certificateAuthorities/certificateAuthoritie-8612/certificates/certificate-8612"; + client.getCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificatesTest() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificatesTest2() throws Exception { + Certificate responsesElement = Certificate.newBuilder().build(); + ListCertificatesResponse expectedResponse = + ListCertificatesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificates(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + + ListCertificatesPagedResponse pagedListResponse = client.listCertificates(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificatesList().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 listCertificatesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + client.listCertificates(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void revokeCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + + Certificate actualResponse = client.revokeCertificate(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 revokeCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + client.revokeCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void revokeCertificateTest2() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-8612/locations/location-8612/certificateAuthorities/certificateAuthoritie-8612/certificates/certificate-8612"; + + Certificate actualResponse = client.revokeCertificate(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 revokeCertificateExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-8612/locations/location-8612/certificateAuthorities/certificateAuthoritie-8612/certificates/certificate-8612"; + client.revokeCertificate(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCertificateTest() throws Exception { + Certificate expectedResponse = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + Certificate certificate = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Certificate actualResponse = client.updateCertificate(certificate, updateMask); + 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 updateCertificateExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Certificate certificate = + Certificate.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setLifetime(Duration.newBuilder().build()) + .setRevocationDetails(Certificate.RevocationDetails.newBuilder().build()) + .setPemCertificate("pemCertificate153491807") + .setCertificateDescription(CertificateDescription.newBuilder().build()) + .addAllPemCertificateChain(new ArrayList()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificate(certificate, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void activateCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("activateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.activateCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void activateCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.activateCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void activateCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("activateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = client.activateCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void activateCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.activateCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + + CertificateAuthority actualResponse = + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .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 createCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + + CertificateAuthority actualResponse = + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .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 createCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + client + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void disableCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("disableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.disableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void disableCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.disableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void disableCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("disableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = client.disableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void disableCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.disableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void enableCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("enableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.enableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void enableCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.enableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void enableCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("enableCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = client.enableCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void enableCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.enableCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void fetchCertificateAuthorityCsrTest() throws Exception { + FetchCertificateAuthorityCsrResponse expectedResponse = + FetchCertificateAuthorityCsrResponse.newBuilder().setPemCsr("pemCsr-991911478").build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + FetchCertificateAuthorityCsrResponse actualResponse = client.fetchCertificateAuthorityCsr(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 fetchCertificateAuthorityCsrExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.fetchCertificateAuthorityCsr(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void fetchCertificateAuthorityCsrTest2() throws Exception { + FetchCertificateAuthorityCsrResponse expectedResponse = + FetchCertificateAuthorityCsrResponse.newBuilder().setPemCsr("pemCsr-991911478").build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + FetchCertificateAuthorityCsrResponse actualResponse = client.fetchCertificateAuthorityCsr(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 fetchCertificateAuthorityCsrExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.fetchCertificateAuthorityCsr(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.getCertificateAuthority(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 getCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.getCertificateAuthority(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = client.getCertificateAuthority(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 getCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.getCertificateAuthority(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateAuthoritiesTest() throws Exception { + CertificateAuthority responsesElement = CertificateAuthority.newBuilder().build(); + ListCertificateAuthoritiesResponse expectedResponse = + ListCertificateAuthoritiesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateAuthorities(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListCertificateAuthoritiesPagedResponse pagedListResponse = + client.listCertificateAuthorities(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateAuthoritiesList().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 listCertificateAuthoritiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listCertificateAuthorities(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateAuthoritiesTest2() throws Exception { + CertificateAuthority responsesElement = CertificateAuthority.newBuilder().build(); + ListCertificateAuthoritiesResponse expectedResponse = + ListCertificateAuthoritiesResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateAuthorities(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListCertificateAuthoritiesPagedResponse pagedListResponse = + client.listCertificateAuthorities(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCertificateAuthoritiesList().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 listCertificateAuthoritiesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listCertificateAuthorities(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void restoreCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("restoreCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = client.restoreCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void restoreCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.restoreCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void restoreCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("restoreCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = client.restoreCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void restoreCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.restoreCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void scheduleDeleteCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("scheduleDeleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + CertificateAuthority actualResponse = + client.scheduleDeleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void scheduleDeleteCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.scheduleDeleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void scheduleDeleteCertificateAuthorityTest2() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("scheduleDeleteCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + + CertificateAuthority actualResponse = + client.scheduleDeleteCertificateAuthorityAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void scheduleDeleteCertificateAuthorityExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5194/locations/location-5194/certificateAuthorities/certificateAuthoritie-5194"; + client.scheduleDeleteCertificateAuthorityAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateCertificateAuthorityTest() throws Exception { + CertificateAuthority expectedResponse = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateAuthorityTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateAuthority certificateAuthority = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateAuthority actualResponse = + client.updateCertificateAuthorityAsync(certificateAuthority, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCertificateAuthorityExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthority certificateAuthority = + CertificateAuthority.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setConfig(CertificateConfig.newBuilder().build()) + .setLifetime(Duration.newBuilder().build()) + .setKeySpec(CertificateAuthority.KeyVersionSpec.newBuilder().build()) + .setCertificatePolicy( + CertificateAuthority.CertificateAuthorityPolicy.newBuilder().build()) + .setIssuingOptions(CertificateAuthority.IssuingOptions.newBuilder().build()) + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .addAllPemCaCertificates(new ArrayList()) + .addAllCaCertificateDescriptions(new ArrayList()) + .setGcsBucket("gcsBucket239654881") + .setAccessUrls(CertificateAuthority.AccessUrls.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateAuthorityAsync(certificateAuthority, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getCertificateRevocationListTest() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE_REVOCATION_LIST]"); + + CertificateRevocationList actualResponse = client.getCertificateRevocationList(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 getCertificateRevocationListExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]"); + client.getCertificateRevocationList(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCertificateRevocationListTest2() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-8416/locations/location-8416/certificateAuthorities/certificateAuthoritie-8416/certificateRevocationLists/certificateRevocationList-8416"; + + CertificateRevocationList actualResponse = client.getCertificateRevocationList(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 getCertificateRevocationListExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-8416/locations/location-8416/certificateAuthorities/certificateAuthoritie-8416/certificateRevocationLists/certificateRevocationList-8416"; + client.getCertificateRevocationList(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateRevocationListsTest() throws Exception { + CertificateRevocationList responsesElement = CertificateRevocationList.newBuilder().build(); + ListCertificateRevocationListsResponse expectedResponse = + ListCertificateRevocationListsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateRevocationLists(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + + ListCertificateRevocationListsPagedResponse pagedListResponse = + client.listCertificateRevocationLists(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCertificateRevocationListsList().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 listCertificateRevocationListsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + client.listCertificateRevocationLists(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCertificateRevocationListsTest2() throws Exception { + CertificateRevocationList responsesElement = CertificateRevocationList.newBuilder().build(); + ListCertificateRevocationListsResponse expectedResponse = + ListCertificateRevocationListsResponse.newBuilder() + .setNextPageToken("") + .addAllCertificateRevocationLists(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + + ListCertificateRevocationListsPagedResponse pagedListResponse = + client.listCertificateRevocationLists(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getCertificateRevocationListsList().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 listCertificateRevocationListsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-2053/locations/location-2053/certificateAuthorities/certificateAuthoritie-2053"; + client.listCertificateRevocationLists(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCertificateRevocationListTest() throws Exception { + CertificateRevocationList expectedResponse = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateCertificateRevocationListTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CertificateRevocationList actualResponse = + client.updateCertificateRevocationListAsync(certificateRevocationList, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCertificateRevocationListExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .setSequenceNumber(-1309190777) + .addAllRevokedCertificates( + new ArrayList()) + .setPemCrl("pemCrl-991911515") + .setAccessUrl("accessUrl-2115048085") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCertificateRevocationListAsync(certificateRevocationList, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getReusableConfigTest() throws Exception { + ReusableConfig expectedResponse = + ReusableConfig.newBuilder() + .setName( + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]").toString()) + .setValues(ReusableConfigValues.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + ReusableConfigName name = ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]"); + + ReusableConfig actualResponse = client.getReusableConfig(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 getReusableConfigExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ReusableConfigName name = + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]"); + client.getReusableConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getReusableConfigTest2() throws Exception { + ReusableConfig expectedResponse = + ReusableConfig.newBuilder() + .setName( + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]").toString()) + .setValues(ReusableConfigValues.newBuilder().build()) + .setDescription("description-1724546052") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .putAllLabels(new HashMap()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-5380/locations/location-5380/reusableConfigs/reusableConfig-5380"; + + ReusableConfig actualResponse = client.getReusableConfig(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 getReusableConfigExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-5380/locations/location-5380/reusableConfigs/reusableConfig-5380"; + client.getReusableConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listReusableConfigsTest() throws Exception { + ReusableConfig responsesElement = ReusableConfig.newBuilder().build(); + ListReusableConfigsResponse expectedResponse = + ListReusableConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllReusableConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListReusableConfigsPagedResponse pagedListResponse = client.listReusableConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReusableConfigsList().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 listReusableConfigsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listReusableConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listReusableConfigsTest2() throws Exception { + ReusableConfig responsesElement = ReusableConfig.newBuilder().build(); + ListReusableConfigsResponse expectedResponse = + ListReusableConfigsResponse.newBuilder() + .setNextPageToken("") + .addAllReusableConfigs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListReusableConfigsPagedResponse pagedListResponse = client.listReusableConfigs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getReusableConfigsList().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 listReusableConfigsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listReusableConfigs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java new file mode 100644 index 00000000..c3029ae4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.SubordinateConfig; +import com.google.longrunning.Operation; + +public class AsyncActivateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncActivateCertificateAuthority(); + } + + public static void asyncActivateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .activateCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java new file mode 100644 index 00000000..4399dbb2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.SubordinateConfig; + +public class AsyncActivateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncActivateCertificateAuthorityLRO(); + } + + public static void asyncActivateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .activateCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java new file mode 100644 index 00000000..d379d219 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.SubordinateConfig; + +public class SyncActivateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthority(); + } + + public static void syncActivateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..328acce4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncActivateCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthorityCertificateauthorityname(); + } + + public static void syncActivateCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java new file mode 100644 index 00000000..7536c82b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncActivateCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthorityString(); + } + + public static void syncActivateCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_activatecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..a008a5f9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceSettings; +import com.google.cloud.security.privateca.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. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..f4813f89 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceSettings; + +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. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder() + .setTransportChannelProvider( + CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder() + .build()) + .build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..82f01d24 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_create_setendpoint_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceSettings; +import com.google.cloud.security.privateca.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. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPool.java new file mode 100644 index 00000000..4aa44477 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcapool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCaPoolRequest; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateCaPool { + + public static void main(String[] args) throws Exception { + asyncCreateCaPool(); + } + + public static void asyncCreateCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCaPoolRequest request = + CreateCaPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCaPoolId("caPoolId-970668971") + .setCaPool(CaPool.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.createCaPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcapool_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPoolLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPoolLRO.java new file mode 100644 index 00000000..b577998d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/AsyncCreateCaPoolLRO.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcapool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCaPoolRequest; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncCreateCaPoolLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCaPoolLRO(); + } + + public static void asyncCreateCaPoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCaPoolRequest request = + CreateCaPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCaPoolId("caPoolId-970668971") + .setCaPool(CaPool.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient.createCaPoolOperationCallable().futureCall(request); + // Do something. + CaPool response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcapool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPool.java new file mode 100644 index 00000000..5a4f846d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcapool_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCaPoolRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCaPool { + + public static void main(String[] args) throws Exception { + syncCreateCaPool(); + } + + public static void syncCreateCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCaPoolRequest request = + CreateCaPoolRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCaPoolId("caPoolId-970668971") + .setCaPool(CaPool.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CaPool response = certificateAuthorityServiceClient.createCaPoolAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcapool_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolLocationnameCapoolString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolLocationnameCapoolString.java new file mode 100644 index 00000000..7dce811c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolLocationnameCapoolString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcapool_locationnamecapoolstring_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCaPoolLocationnameCapoolString { + + public static void main(String[] args) throws Exception { + syncCreateCaPoolLocationnameCapoolString(); + } + + public static void syncCreateCaPoolLocationnameCapoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + CaPool response = + certificateAuthorityServiceClient.createCaPoolAsync(parent, caPool, caPoolId).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcapool_locationnamecapoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolStringCapoolString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolStringCapoolString.java new file mode 100644 index 00000000..ecc4ab39 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcapool/SyncCreateCaPoolStringCapoolString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcapool_stringcapoolstring_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCaPoolStringCapoolString { + + public static void main(String[] args) throws Exception { + syncCreateCaPoolStringCapoolString(); + } + + public static void syncCreateCaPoolStringCapoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CaPool caPool = CaPool.newBuilder().build(); + String caPoolId = "caPoolId-970668971"; + CaPool response = + certificateAuthorityServiceClient.createCaPoolAsync(parent, caPool, caPoolId).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcapool_stringcapoolstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java new file mode 100644 index 00000000..e9db1658 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCertificateRequest; + +public class AsyncCreateCertificate { + + public static void main(String[] args) throws Exception { + asyncCreateCertificate(); + } + + public static void asyncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setIssuingCertificateAuthorityId("issuingCertificateAuthorityId-559908707") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.createCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..38af66b9 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificate_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCertificateRequest; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .setRequestId("requestId693933066") + .setValidateOnly(true) + .setIssuingCertificateAuthorityId("issuingCertificateAuthorityId-559908707") + .build(); + Certificate response = certificateAuthorityServiceClient.createCertificate(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCapoolnameCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCapoolnameCertificateString.java new file mode 100644 index 00000000..7f54aefd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCapoolnameCertificateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificate_capoolnamecertificatestring_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateCapoolnameCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateCapoolnameCertificateString(); + } + + public static void syncCreateCertificateCapoolnameCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateAuthorityServiceClient.createCertificate(parent, certificate, certificateId); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificate_capoolnamecertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java new file mode 100644 index 00000000..ae1d4fd7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificate_stringcertificatestring_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateStringCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateStringCertificateString(); + } + + public static void syncCreateCertificateStringCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateAuthorityServiceClient.createCertificate(parent, certificate, certificateId); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificate_stringcertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java new file mode 100644 index 00000000..bb336e73 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateAuthority(); + } + + public static void asyncCreateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .createCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java new file mode 100644 index 00000000..1cc6b5c5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncCreateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateAuthorityLRO(); + } + + public static void asyncCreateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .createCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java new file mode 100644 index 00000000..56112608 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CreateCertificateAuthorityRequest; + +public class SyncCreateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthority(); + } + + public static void syncCreateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.createCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityCapoolnameCertificateauthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityCapoolnameCertificateauthorityString.java new file mode 100644 index 00000000..9ceb6039 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityCapoolnameCertificateauthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_capoolnamecertificateauthoritystring_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateAuthorityCapoolnameCertificateauthorityString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthorityCapoolnameCertificateauthorityString(); + } + + public static void syncCreateCertificateAuthorityCapoolnameCertificateauthorityString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + CertificateAuthority response = + certificateAuthorityServiceClient + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_capoolnamecertificateauthoritystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java new file mode 100644 index 00000000..90dba41b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_stringcertificateauthoritystring_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateAuthorityStringCertificateauthorityString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthorityStringCertificateauthorityString(); + } + + public static void syncCreateCertificateAuthorityStringCertificateauthorityString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + CertificateAuthority response = + certificateAuthorityServiceClient + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificateauthority_stringcertificateauthoritystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplate.java new file mode 100644 index 00000000..317590d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificateTemplate { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateTemplate(); + } + + public static void asyncCreateCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateTemplateRequest request = + CreateCertificateTemplateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateTemplateId("certificateTemplateId1920134188") + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.createCertificateTemplateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplateLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplateLRO.java new file mode 100644 index 00000000..a1176e88 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/AsyncCreateCertificateTemplateLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncCreateCertificateTemplateLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateTemplateLRO(); + } + + public static void asyncCreateCertificateTemplateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateTemplateRequest request = + CreateCertificateTemplateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateTemplateId("certificateTemplateId1920134188") + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .createCertificateTemplateOperationCallable() + .futureCall(request); + // Do something. + CertificateTemplate response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplate.java new file mode 100644 index 00000000..89b5996d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CreateCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCertificateTemplate { + + public static void main(String[] args) throws Exception { + syncCreateCertificateTemplate(); + } + + public static void syncCreateCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateTemplateRequest request = + CreateCertificateTemplateRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateTemplateId("certificateTemplateId1920134188") + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateTemplate response = + certificateAuthorityServiceClient.createCertificateTemplateAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateLocationnameCertificatetemplateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateLocationnameCertificatetemplateString.java new file mode 100644 index 00000000..d1c77050 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateLocationnameCertificatetemplateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_locationnamecertificatetemplatestring_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCertificateTemplateLocationnameCertificatetemplateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateTemplateLocationnameCertificatetemplateString(); + } + + public static void syncCreateCertificateTemplateLocationnameCertificatetemplateString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + CertificateTemplate response = + certificateAuthorityServiceClient + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_locationnamecertificatetemplatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateStringCertificatetemplateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateStringCertificatetemplateString.java new file mode 100644 index 00000000..3265436f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/createcertificatetemplate/SyncCreateCertificateTemplateStringCertificatetemplateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_stringcertificatetemplatestring_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncCreateCertificateTemplateStringCertificatetemplateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateTemplateStringCertificatetemplateString(); + } + + public static void syncCreateCertificateTemplateStringCertificatetemplateString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + String certificateTemplateId = "certificateTemplateId1920134188"; + CertificateTemplate response = + certificateAuthorityServiceClient + .createCertificateTemplateAsync(parent, certificateTemplate, certificateTemplateId) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_createcertificatetemplate_stringcertificatetemplatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPool.java new file mode 100644 index 00000000..804d38ed --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecapool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCaPoolRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCaPool { + + public static void main(String[] args) throws Exception { + asyncDeleteCaPool(); + } + + public static void asyncDeleteCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCaPoolRequest request = + DeleteCaPoolRequest.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.deleteCaPoolCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecapool_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPoolLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPoolLRO.java new file mode 100644 index 00000000..f0980d76 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/AsyncDeleteCaPoolLRO.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecapool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCaPoolRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteCaPoolLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCaPoolLRO(); + } + + public static void asyncDeleteCaPoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCaPoolRequest request = + DeleteCaPoolRequest.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient.deleteCaPoolOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecapool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPool.java new file mode 100644 index 00000000..ff167c4a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecapool_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCaPoolRequest; + +public class SyncDeleteCaPool { + + public static void main(String[] args) throws Exception { + syncDeleteCaPool(); + } + + public static void syncDeleteCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCaPoolRequest request = + DeleteCaPoolRequest.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setRequestId("requestId693933066") + .build(); + certificateAuthorityServiceClient.deleteCaPoolAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecapool_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolCapoolname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolCapoolname.java new file mode 100644 index 00000000..e3b04c31 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolCapoolname.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecapool_capoolname_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDeleteCaPoolCapoolname { + + public static void main(String[] args) throws Exception { + syncDeleteCaPoolCapoolname(); + } + + public static void syncDeleteCaPoolCapoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + certificateAuthorityServiceClient.deleteCaPoolAsync(name).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecapool_capoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolString.java new file mode 100644 index 00000000..e17c0cef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecapool/SyncDeleteCaPoolString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecapool_string_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDeleteCaPoolString { + + public static void main(String[] args) throws Exception { + syncDeleteCaPoolString(); + } + + public static void syncDeleteCaPoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + certificateAuthorityServiceClient.deleteCaPoolAsync(name).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecapool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthority.java new file mode 100644 index 00000000..9c135c13 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthority.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateAuthority(); + } + + public static void asyncDeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateAuthorityRequest request = + DeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .setIgnoreActiveCertificates(true) + .setSkipGracePeriod(true) + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .deleteCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthorityLRO.java new file mode 100644 index 00000000..e1c40fb0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/AsyncDeleteCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncDeleteCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateAuthorityLRO(); + } + + public static void asyncDeleteCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateAuthorityRequest request = + DeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .setIgnoreActiveCertificates(true) + .setSkipGracePeriod(true) + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .deleteCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthority.java new file mode 100644 index 00000000..957c980e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DeleteCertificateAuthorityRequest; + +public class SyncDeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateAuthority(); + } + + public static void syncDeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateAuthorityRequest request = + DeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .setIgnoreActiveCertificates(true) + .setSkipGracePeriod(true) + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.deleteCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..78e4e706 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDeleteCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateAuthorityCertificateauthorityname(); + } + + public static void syncDeleteCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.deleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityString.java new file mode 100644 index 00000000..b87c3785 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificateauthority/SyncDeleteCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDeleteCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateAuthorityString(); + } + + public static void syncDeleteCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.deleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplate.java new file mode 100644 index 00000000..f4bf9d03 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; +import com.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest; +import com.google.longrunning.Operation; + +public class AsyncDeleteCertificateTemplate { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateTemplate(); + } + + public static void asyncDeleteCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateTemplateRequest request = + DeleteCertificateTemplateRequest.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.deleteCertificateTemplateCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplateLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplateLRO.java new file mode 100644 index 00000000..3a4f46f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/AsyncDeleteCertificateTemplateLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; +import com.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.protobuf.Empty; + +public class AsyncDeleteCertificateTemplateLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteCertificateTemplateLRO(); + } + + public static void asyncDeleteCertificateTemplateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateTemplateRequest request = + DeleteCertificateTemplateRequest.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .deleteCertificateTemplateOperationCallable() + .futureCall(request); + // Do something. + future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplate.java new file mode 100644 index 00000000..8847f70d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; +import com.google.cloud.security.privateca.v1.DeleteCertificateTemplateRequest; + +public class SyncDeleteCertificateTemplate { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateTemplate(); + } + + public static void syncDeleteCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DeleteCertificateTemplateRequest request = + DeleteCertificateTemplateRequest.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .setRequestId("requestId693933066") + .build(); + certificateAuthorityServiceClient.deleteCertificateTemplateAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateCertificatetemplatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateCertificatetemplatename.java new file mode 100644 index 00000000..b901bf37 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateCertificatetemplatename.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_certificatetemplatename_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; + +public class SyncDeleteCertificateTemplateCertificatetemplatename { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateTemplateCertificatetemplatename(); + } + + public static void syncDeleteCertificateTemplateCertificatetemplatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + certificateAuthorityServiceClient.deleteCertificateTemplateAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_certificatetemplatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateString.java new file mode 100644 index 00000000..01e903b1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/deletecertificatetemplate/SyncDeleteCertificateTemplateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; + +public class SyncDeleteCertificateTemplateString { + + public static void main(String[] args) throws Exception { + syncDeleteCertificateTemplateString(); + } + + public static void syncDeleteCertificateTemplateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString(); + certificateAuthorityServiceClient.deleteCertificateTemplateAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_deletecertificatetemplate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java new file mode 100644 index 00000000..1a2c3672 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncDisableCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncDisableCertificateAuthority(); + } + + public static void asyncDisableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .disableCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java new file mode 100644 index 00000000..c8367abd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncDisableCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncDisableCertificateAuthorityLRO(); + } + + public static void asyncDisableCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .disableCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java new file mode 100644 index 00000000..7e8acdea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.DisableCertificateAuthorityRequest; + +public class SyncDisableCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthority(); + } + + public static void syncDisableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..c8742803 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDisableCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthorityCertificateauthorityname(); + } + + public static void syncDisableCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java new file mode 100644 index 00000000..ed6cf559 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncDisableCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthorityString(); + } + + public static void syncDisableCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_disablecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java new file mode 100644 index 00000000..2833aa4d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncEnableCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncEnableCertificateAuthority(); + } + + public static void asyncEnableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .enableCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java new file mode 100644 index 00000000..8cde51ed --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1.OperationMetadata; + +public class AsyncEnableCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncEnableCertificateAuthorityLRO(); + } + + public static void asyncEnableCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .enableCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java new file mode 100644 index 00000000..f5bc7767 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.EnableCertificateAuthorityRequest; + +public class SyncEnableCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthority(); + } + + public static void syncEnableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..6ee25eda --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncEnableCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthorityCertificateauthorityname(); + } + + public static void syncEnableCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java new file mode 100644 index 00000000..57d613bd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncEnableCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthorityString(); + } + + public static void syncEnableCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_enablecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/AsyncFetchCaCerts.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/AsyncFetchCaCerts.java new file mode 100644 index 00000000..b6714ee5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/AsyncFetchCaCerts.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCaCertsRequest; +import com.google.cloud.security.privateca.v1.FetchCaCertsResponse; + +public class AsyncFetchCaCerts { + + public static void main(String[] args) throws Exception { + asyncFetchCaCerts(); + } + + public static void asyncFetchCaCerts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCaCertsRequest request = + FetchCaCertsRequest.newBuilder() + .setCaPool(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.fetchCaCertsCallable().futureCall(request); + // Do something. + FetchCaCertsResponse response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCerts.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCerts.java new file mode 100644 index 00000000..3663dc06 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCerts.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCaCertsRequest; +import com.google.cloud.security.privateca.v1.FetchCaCertsResponse; + +public class SyncFetchCaCerts { + + public static void main(String[] args) throws Exception { + syncFetchCaCerts(); + } + + public static void syncFetchCaCerts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCaCertsRequest request = + FetchCaCertsRequest.newBuilder() + .setCaPool(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setRequestId("requestId693933066") + .build(); + FetchCaCertsResponse response = certificateAuthorityServiceClient.fetchCaCerts(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsCapoolname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsCapoolname.java new file mode 100644 index 00000000..2f181ec2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsCapoolname.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_capoolname_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCaCertsResponse; + +public class SyncFetchCaCertsCapoolname { + + public static void main(String[] args) throws Exception { + syncFetchCaCertsCapoolname(); + } + + public static void syncFetchCaCertsCapoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName caPool = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + FetchCaCertsResponse response = certificateAuthorityServiceClient.fetchCaCerts(caPool); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_capoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsString.java new file mode 100644 index 00000000..a6cec1a5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcacerts/SyncFetchCaCertsString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_string_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCaCertsResponse; + +public class SyncFetchCaCertsString { + + public static void main(String[] args) throws Exception { + syncFetchCaCertsString(); + } + + public static void syncFetchCaCertsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String caPool = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + FetchCaCertsResponse response = certificateAuthorityServiceClient.fetchCaCerts(caPool); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcacerts_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java new file mode 100644 index 00000000..d3403937 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse; + +public class AsyncFetchCertificateAuthorityCsr { + + public static void main(String[] args) throws Exception { + asyncFetchCertificateAuthorityCsr(); + } + + public static void asyncFetchCertificateAuthorityCsr() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCertificateAuthorityCsrRequest request = + FetchCertificateAuthorityCsrRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .fetchCertificateAuthorityCsrCallable() + .futureCall(request); + // Do something. + FetchCertificateAuthorityCsrResponse response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java new file mode 100644 index 00000000..1fece087 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsr { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsr(); + } + + public static void syncFetchCertificateAuthorityCsr() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCertificateAuthorityCsrRequest request = + FetchCertificateAuthorityCsrRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java new file mode 100644 index 00000000..f828f7e5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsrCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsrCertificateauthorityname(); + } + + public static void syncFetchCertificateAuthorityCsrCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java new file mode 100644 index 00000000..90c1de67 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsrString { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsrString(); + } + + public static void syncFetchCertificateAuthorityCsrString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/AsyncGetCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/AsyncGetCaPool.java new file mode 100644 index 00000000..f1de9426 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/AsyncGetCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcapool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.GetCaPoolRequest; + +public class AsyncGetCaPool { + + public static void main(String[] args) throws Exception { + asyncGetCaPool(); + } + + public static void asyncGetCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCaPoolRequest request = + GetCaPoolRequest.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCaPoolCallable().futureCall(request); + // Do something. + CaPool response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcapool_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPool.java new file mode 100644 index 00000000..a8c54827 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcapool_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.GetCaPoolRequest; + +public class SyncGetCaPool { + + public static void main(String[] args) throws Exception { + syncGetCaPool(); + } + + public static void syncGetCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCaPoolRequest request = + GetCaPoolRequest.newBuilder() + .setName(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .build(); + CaPool response = certificateAuthorityServiceClient.getCaPool(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcapool_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolCapoolname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolCapoolname.java new file mode 100644 index 00000000..197861c7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolCapoolname.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcapool_capoolname_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncGetCaPoolCapoolname { + + public static void main(String[] args) throws Exception { + syncGetCaPoolCapoolname(); + } + + public static void syncGetCaPoolCapoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + CaPool response = certificateAuthorityServiceClient.getCaPool(name); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcapool_capoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolString.java new file mode 100644 index 00000000..e6917e4f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcapool/SyncGetCaPoolString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcapool_string_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncGetCaPoolString { + + public static void main(String[] args) throws Exception { + syncGetCaPoolString(); + } + + public static void syncGetCaPoolString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + CaPool response = certificateAuthorityServiceClient.getCaPool(name); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcapool_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java new file mode 100644 index 00000000..224f12d5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; +import com.google.cloud.security.privateca.v1.GetCertificateRequest; + +public class AsyncGetCertificate { + + public static void main(String[] args) throws Exception { + asyncGetCertificate(); + } + + public static void asyncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java new file mode 100644 index 00000000..1307be5e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificate_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; +import com.google.cloud.security.privateca.v1.GetCertificateRequest; + +public class SyncGetCertificate { + + public static void main(String[] args) throws Exception { + syncGetCertificate(); + } + + public static void syncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .build(); + Certificate response = certificateAuthorityServiceClient.getCertificate(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java new file mode 100644 index 00000000..311f7bdb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificate_certificatename_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; + +public class SyncGetCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncGetCertificateCertificatename(); + } + + public static void syncGetCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + Certificate response = certificateAuthorityServiceClient.getCertificate(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java new file mode 100644 index 00000000..61fb6f08 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificate_string_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; + +public class SyncGetCertificateString { + + public static void main(String[] args) throws Exception { + syncGetCertificateString(); + } + + public static void syncGetCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]").toString(); + Certificate response = certificateAuthorityServiceClient.getCertificate(name); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java new file mode 100644 index 00000000..fa697b85 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest; + +public class AsyncGetCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncGetCertificateAuthority(); + } + + public static void asyncGetCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCertificateAuthorityCallable().futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java new file mode 100644 index 00000000..0fbf2205 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.GetCertificateAuthorityRequest; + +public class SyncGetCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthority(); + } + + public static void syncGetCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..fbe012e4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncGetCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthorityCertificateauthorityname(); + } + + public static void syncGetCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java new file mode 100644 index 00000000..6603d9bf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncGetCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthorityString(); + } + + public static void syncGetCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java new file mode 100644 index 00000000..148dd40c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.CertificateRevocationListName; +import com.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest; + +public class AsyncGetCertificateRevocationList { + + public static void main(String[] args) throws Exception { + asyncGetCertificateRevocationList(); + } + + public static void asyncGetCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRevocationListRequest request = + GetCertificateRevocationListRequest.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .getCertificateRevocationListCallable() + .futureCall(request); + // Do something. + CertificateRevocationList response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java new file mode 100644 index 00000000..6f6dcb9e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.CertificateRevocationListName; +import com.google.cloud.security.privateca.v1.GetCertificateRevocationListRequest; + +public class SyncGetCertificateRevocationList { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationList(); + } + + public static void syncGetCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRevocationListRequest request = + GetCertificateRevocationListRequest.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .build(); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java new file mode 100644 index 00000000..5f7dcd27 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_certificaterevocationlistname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.CertificateRevocationListName; + +public class SyncGetCertificateRevocationListCertificaterevocationlistname { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationListCertificaterevocationlistname(); + } + + public static void syncGetCertificateRevocationListCertificaterevocationlistname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]"); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_certificaterevocationlistname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java new file mode 100644 index 00000000..d0bc0aae --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.CertificateRevocationListName; + +public class SyncGetCertificateRevocationListString { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationListString(); + } + + public static void syncGetCertificateRevocationListString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CA_POOL]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString(); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/AsyncGetCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/AsyncGetCertificateTemplate.java new file mode 100644 index 00000000..cba5bceb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/AsyncGetCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; +import com.google.cloud.security.privateca.v1.GetCertificateTemplateRequest; + +public class AsyncGetCertificateTemplate { + + public static void main(String[] args) throws Exception { + asyncGetCertificateTemplate(); + } + + public static void asyncGetCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateTemplateRequest request = + GetCertificateTemplateRequest.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCertificateTemplateCallable().futureCall(request); + // Do something. + CertificateTemplate response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplate.java new file mode 100644 index 00000000..36d0c0e4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; +import com.google.cloud.security.privateca.v1.GetCertificateTemplateRequest; + +public class SyncGetCertificateTemplate { + + public static void main(String[] args) throws Exception { + syncGetCertificateTemplate(); + } + + public static void syncGetCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateTemplateRequest request = + GetCertificateTemplateRequest.newBuilder() + .setName( + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString()) + .build(); + CertificateTemplate response = + certificateAuthorityServiceClient.getCertificateTemplate(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateCertificatetemplatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateCertificatetemplatename.java new file mode 100644 index 00000000..54c81202 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateCertificatetemplatename.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_certificatetemplatename_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; + +public class SyncGetCertificateTemplateCertificatetemplatename { + + public static void main(String[] args) throws Exception { + syncGetCertificateTemplateCertificatetemplatename(); + } + + public static void syncGetCertificateTemplateCertificatetemplatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateTemplateName name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]"); + CertificateTemplate response = certificateAuthorityServiceClient.getCertificateTemplate(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_certificatetemplatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateString.java new file mode 100644 index 00000000..6567e79a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getcertificatetemplate/SyncGetCertificateTemplateString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.CertificateTemplateName; + +public class SyncGetCertificateTemplateString { + + public static void main(String[] args) throws Exception { + syncGetCertificateTemplateString(); + } + + public static void syncGetCertificateTemplateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateTemplateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_TEMPLATE]") + .toString(); + CertificateTemplate response = certificateAuthorityServiceClient.getCertificateTemplate(name); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getcertificatetemplate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/AsyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 00000000..604cec1c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/AsyncGetIamPolicy.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/SyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 00000000..9a2581c3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getiampolicy/SyncGetIamPolicy.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getiampolicy_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = certificateAuthorityServiceClient.getIamPolicy(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/AsyncGetLocation.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/AsyncGetLocation.java new file mode 100644 index 00000000..26df1e12 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/AsyncGetLocation.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getlocation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class AsyncGetLocation { + + public static void main(String[] args) throws Exception { + asyncGetLocation(); + } + + public static void asyncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + ApiFuture future = + certificateAuthorityServiceClient.getLocationCallable().futureCall(request); + // Do something. + Location response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getlocation_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/SyncGetLocation.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/SyncGetLocation.java new file mode 100644 index 00000000..16aedfe5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/getlocation/SyncGetLocation.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_getlocation_sync] +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncGetLocation { + + public static void main(String[] args) throws Exception { + syncGetLocation(); + } + + public static void syncGetLocation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + Location response = certificateAuthorityServiceClient.getLocation(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_getlocation_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPools.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPools.java new file mode 100644 index 00000000..74e5fcd7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPools.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcapools_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCaPoolsRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class AsyncListCaPools { + + public static void main(String[] args) throws Exception { + asyncListCaPools(); + } + + public static void asyncListCaPools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCaPoolsRequest request = + ListCaPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.listCaPoolsPagedCallable().futureCall(request); + // Do something. + for (CaPool element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcapools_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPoolsPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPoolsPaged.java new file mode 100644 index 00000000..e6a00e0d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/AsyncListCaPoolsPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcapools_paged_async] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCaPoolsRequest; +import com.google.cloud.security.privateca.v1.ListCaPoolsResponse; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListCaPoolsPaged { + + public static void main(String[] args) throws Exception { + asyncListCaPoolsPaged(); + } + + public static void asyncListCaPoolsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCaPoolsRequest request = + ListCaPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCaPoolsResponse response = + certificateAuthorityServiceClient.listCaPoolsCallable().call(request); + for (CaPool element : response.getCaPoolsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcapools_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPools.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPools.java new file mode 100644 index 00000000..4504fc19 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPools.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcapools_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCaPoolsRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCaPools { + + public static void main(String[] args) throws Exception { + syncListCaPools(); + } + + public static void syncListCaPools() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCaPoolsRequest request = + ListCaPoolsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CaPool element : certificateAuthorityServiceClient.listCaPools(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcapools_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsLocationname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsLocationname.java new file mode 100644 index 00000000..51ff3320 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsLocationname.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcapools_locationname_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCaPoolsLocationname { + + public static void main(String[] args) throws Exception { + syncListCaPoolsLocationname(); + } + + public static void syncListCaPoolsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CaPool element : certificateAuthorityServiceClient.listCaPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcapools_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsString.java new file mode 100644 index 00000000..b7b3f7a1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcapools/SyncListCaPoolsString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcapools_string_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCaPoolsString { + + public static void main(String[] args) throws Exception { + syncListCaPoolsString(); + } + + public static void syncListCaPoolsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CaPool element : certificateAuthorityServiceClient.listCaPools(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcapools_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java new file mode 100644 index 00000000..095370ec --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest; + +public class AsyncListCertificateAuthorities { + + public static void main(String[] args) throws Exception { + asyncListCertificateAuthorities(); + } + + public static void asyncListCertificateAuthorities() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .listCertificateAuthoritiesPagedCallable() + .futureCall(request); + // Do something. + for (CertificateAuthority element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java new file mode 100644 index 00000000..1cc08edd --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_paged_async] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificateAuthoritiesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateAuthoritiesPaged(); + } + + public static void asyncListCertificateAuthoritiesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateAuthoritiesResponse response = + certificateAuthorityServiceClient.listCertificateAuthoritiesCallable().call(request); + for (CertificateAuthority element : response.getCertificateAuthoritiesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java new file mode 100644 index 00000000..c8a376e0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificateAuthoritiesRequest; + +public class SyncListCertificateAuthorities { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthorities(); + } + + public static void syncListCertificateAuthorities() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesCapoolname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesCapoolname.java new file mode 100644 index 00000000..73228f11 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesCapoolname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_capoolname_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncListCertificateAuthoritiesCapoolname { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthoritiesCapoolname(); + } + + public static void syncListCertificateAuthoritiesCapoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_capoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java new file mode 100644 index 00000000..3c148d66 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_string_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncListCertificateAuthoritiesString { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthoritiesString(); + } + + public static void syncListCertificateAuthoritiesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificateauthorities_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java new file mode 100644 index 00000000..c57a5938 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest; + +public class AsyncListCertificateRevocationLists { + + public static void main(String[] args) throws Exception { + asyncListCertificateRevocationLists(); + } + + public static void asyncListCertificateRevocationLists() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .listCertificateRevocationListsPagedCallable() + .futureCall(request); + // Do something. + for (CertificateRevocationList element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java new file mode 100644 index 00000000..9281a3d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java @@ -0,0 +1,69 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_paged_async] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificateRevocationListsPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateRevocationListsPaged(); + } + + public static void asyncListCertificateRevocationListsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateRevocationListsResponse response = + certificateAuthorityServiceClient + .listCertificateRevocationListsCallable() + .call(request); + for (CertificateRevocationList element : response.getCertificateRevocationListsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java new file mode 100644 index 00000000..40473b4e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.ListCertificateRevocationListsRequest; + +public class SyncListCertificateRevocationLists { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationLists(); + } + + public static void syncListCertificateRevocationLists() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java new file mode 100644 index 00000000..0597ac11 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; + +public class SyncListCertificateRevocationListsCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationListsCertificateauthorityname(); + } + + public static void syncListCertificateRevocationListsCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName parent = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java new file mode 100644 index 00000000..405b7e98 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; + +public class SyncListCertificateRevocationListsString { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationListsString(); + } + + public static void syncListCertificateRevocationListsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java new file mode 100644 index 00000000..9de81a48 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificates_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificatesRequest; + +public class AsyncListCertificates { + + public static void main(String[] args) throws Exception { + asyncListCertificates(); + } + + public static void asyncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.listCertificatesPagedCallable().futureCall(request); + // Do something. + for (Certificate element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificates_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java new file mode 100644 index 00000000..39a3e80e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificates_paged_async] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificatesRequest; +import com.google.cloud.security.privateca.v1.ListCertificatesResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificatesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificatesPaged(); + } + + public static void asyncListCertificatesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificatesResponse response = + certificateAuthorityServiceClient.listCertificatesCallable().call(request); + for (Certificate element : response.getCertificatesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificates_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java new file mode 100644 index 00000000..35886384 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificates_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.ListCertificatesRequest; + +public class SyncListCertificates { + + public static void main(String[] args) throws Exception { + syncListCertificates(); + } + + public static void syncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificates_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCapoolname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCapoolname.java new file mode 100644 index 00000000..0dae278f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCapoolname.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificates_capoolname_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncListCertificatesCapoolname { + + public static void main(String[] args) throws Exception { + syncListCertificatesCapoolname(); + } + + public static void syncListCertificatesCapoolname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPoolName parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]"); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificates_capoolname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java new file mode 100644 index 00000000..c2eb8615 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificates_string_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncListCertificatesString { + + public static void main(String[] args) throws Exception { + syncListCertificatesString(); + } + + public static void syncListCertificatesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString(); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificates_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplates.java new file mode 100644 index 00000000..6283ddd8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplates.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class AsyncListCertificateTemplates { + + public static void main(String[] args) throws Exception { + asyncListCertificateTemplates(); + } + + public static void asyncListCertificateTemplates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateTemplatesRequest request = + ListCertificateTemplatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .listCertificateTemplatesPagedCallable() + .futureCall(request); + // Do something. + for (CertificateTemplate element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplatesPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplatesPaged.java new file mode 100644 index 00000000..7ab65371 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/AsyncListCertificateTemplatesPaged.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_paged_async] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesResponse; +import com.google.cloud.security.privateca.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListCertificateTemplatesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateTemplatesPaged(); + } + + public static void asyncListCertificateTemplatesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateTemplatesRequest request = + ListCertificateTemplatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateTemplatesResponse response = + certificateAuthorityServiceClient.listCertificateTemplatesCallable().call(request); + for (CertificateTemplate element : response.getCertificateTemplatesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplates.java new file mode 100644 index 00000000..b1849bfe --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplates.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.ListCertificateTemplatesRequest; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCertificateTemplates { + + public static void main(String[] args) throws Exception { + syncListCertificateTemplates(); + } + + public static void syncListCertificateTemplates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateTemplatesRequest request = + ListCertificateTemplatesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateTemplate element : + certificateAuthorityServiceClient.listCertificateTemplates(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesLocationname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesLocationname.java new file mode 100644 index 00000000..1ad99a4c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesLocationname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_locationname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCertificateTemplatesLocationname { + + public static void main(String[] args) throws Exception { + syncListCertificateTemplatesLocationname(); + } + + public static void syncListCertificateTemplatesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CertificateTemplate element : + certificateAuthorityServiceClient.listCertificateTemplates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesString.java new file mode 100644 index 00000000..0cb124a2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listcertificatetemplates/SyncListCertificateTemplatesString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.LocationName; + +public class SyncListCertificateTemplatesString { + + public static void main(String[] args) throws Exception { + syncListCertificateTemplatesString(); + } + + public static void syncListCertificateTemplatesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CertificateTemplate element : + certificateAuthorityServiceClient.listCertificateTemplates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_listcertificatetemplates_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocations.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocations.java new file mode 100644 index 00000000..af5010ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocations.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listlocations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class AsyncListLocations { + + public static void main(String[] args) throws Exception { + asyncListLocations(); + } + + public static void asyncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.listLocationsPagedCallable().futureCall(request); + // Do something. + for (Location element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listlocations_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocationsPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocationsPaged.java new file mode 100644 index 00000000..214d7519 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/AsyncListLocationsPaged.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listlocations_paged_async] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.common.base.Strings; + +public class AsyncListLocationsPaged { + + public static void main(String[] args) throws Exception { + asyncListLocationsPaged(); + } + + public static void asyncListLocationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListLocationsResponse response = + certificateAuthorityServiceClient.listLocationsCallable().call(request); + for (Location element : response.getLocationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listlocations_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/SyncListLocations.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/SyncListLocations.java new file mode 100644 index 00000000..ee75a2ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/listlocations/SyncListLocations.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_listlocations_sync] +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.Location; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncListLocations { + + public static void main(String[] args) throws Exception { + syncListLocations(); + } + + public static void syncListLocations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListLocationsRequest request = + ListLocationsRequest.newBuilder() + .setName("name3373707") + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Location element : + certificateAuthorityServiceClient.listLocations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_listlocations_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java new file mode 100644 index 00000000..4acb460c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; +import com.google.cloud.security.privateca.v1.RevocationReason; +import com.google.cloud.security.privateca.v1.RevokeCertificateRequest; + +public class AsyncRevokeCertificate { + + public static void main(String[] args) throws Exception { + asyncRevokeCertificate(); + } + + public static void asyncRevokeCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RevokeCertificateRequest request = + RevokeCertificateRequest.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setReason(RevocationReason.forNumber(0)) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.revokeCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java new file mode 100644 index 00000000..593b48cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; +import com.google.cloud.security.privateca.v1.RevocationReason; +import com.google.cloud.security.privateca.v1.RevokeCertificateRequest; + +public class SyncRevokeCertificate { + + public static void main(String[] args) throws Exception { + syncRevokeCertificate(); + } + + public static void syncRevokeCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RevokeCertificateRequest request = + RevokeCertificateRequest.newBuilder() + .setName( + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]") + .toString()) + .setReason(RevocationReason.forNumber(0)) + .setRequestId("requestId693933066") + .build(); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java new file mode 100644 index 00000000..1e061da2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_certificatename_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; + +public class SyncRevokeCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncRevokeCertificateCertificatename(); + } + + public static void syncRevokeCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]"); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(name); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java new file mode 100644 index 00000000..22973f43 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_string_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateName; + +public class SyncRevokeCertificateString { + + public static void main(String[] args) throws Exception { + syncRevokeCertificateString(); + } + + public static void syncRevokeCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE]").toString(); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(name); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_revokecertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/AsyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 00000000..503a0822 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/AsyncSetIamPolicy.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_setiampolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_setiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/SyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 00000000..1d2e1193 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/setiampolicy/SyncSetIamPolicy.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_setiampolicy_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = certificateAuthorityServiceClient.setIamPolicy(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_setiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/AsyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 00000000..404d0c81 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/AsyncTestIamPermissions.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_testiampermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_testiampermissions_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/SyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 00000000..dd19168e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/testiampermissions/SyncTestIamPermissions.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_testiampermissions_sync] +import com.google.cloud.security.privateca.v1.CaPoolName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(CaPoolName.of("[PROJECT]", "[LOCATION]", "[CA_POOL]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = + certificateAuthorityServiceClient.testIamPermissions(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_testiampermissions_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthority.java new file mode 100644 index 00000000..74d7fc4c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthority.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncUndeleteCertificateAuthority(); + } + + public static void asyncUndeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UndeleteCertificateAuthorityRequest request = + UndeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .undeleteCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthorityLRO.java new file mode 100644 index 00000000..36790da6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/AsyncUndeleteCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest; + +public class AsyncUndeleteCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncUndeleteCertificateAuthorityLRO(); + } + + public static void asyncUndeleteCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UndeleteCertificateAuthorityRequest request = + UndeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .undeleteCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthority.java new file mode 100644 index 00000000..098ab5ce --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthority.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UndeleteCertificateAuthorityRequest; + +public class SyncUndeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncUndeleteCertificateAuthority(); + } + + public static void syncUndeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UndeleteCertificateAuthorityRequest request = + UndeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.undeleteCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..ab2fd9f8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityCertificateauthorityname.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncUndeleteCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncUndeleteCertificateAuthorityCertificateauthorityname(); + } + + public static void syncUndeleteCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.undeleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityString.java new file mode 100644 index 00000000..7ab50e2f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/undeletecertificateauthority/SyncUndeleteCertificateAuthorityString.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; + +public class SyncUndeleteCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncUndeleteCertificateAuthorityString(); + } + + public static void syncUndeleteCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of( + "[PROJECT]", "[LOCATION]", "[CA_POOL]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.undeleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_undeletecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPool.java new file mode 100644 index 00000000..05441d96 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecapool_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCaPoolRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCaPool { + + public static void main(String[] args) throws Exception { + asyncUpdateCaPool(); + } + + public static void asyncUpdateCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCaPoolRequest request = + UpdateCaPoolRequest.newBuilder() + .setCaPool(CaPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.updateCaPoolCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecapool_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPoolLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPoolLRO.java new file mode 100644 index 00000000..b29d3bc1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/AsyncUpdateCaPoolLRO.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecapool_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.UpdateCaPoolRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCaPoolLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCaPoolLRO(); + } + + public static void asyncUpdateCaPoolLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCaPoolRequest request = + UpdateCaPoolRequest.newBuilder() + .setCaPool(CaPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient.updateCaPoolOperationCallable().futureCall(request); + // Do something. + CaPool response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecapool_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPool.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPool.java new file mode 100644 index 00000000..29d63f1d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPool.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecapool_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCaPoolRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCaPool { + + public static void main(String[] args) throws Exception { + syncUpdateCaPool(); + } + + public static void syncUpdateCaPool() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCaPoolRequest request = + UpdateCaPoolRequest.newBuilder() + .setCaPool(CaPool.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CaPool response = certificateAuthorityServiceClient.updateCaPoolAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecapool_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPoolCapoolFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPoolCapoolFieldmask.java new file mode 100644 index 00000000..3ce6a441 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecapool/SyncUpdateCaPoolCapoolFieldmask.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecapool_capoolfieldmask_sync] +import com.google.cloud.security.privateca.v1.CaPool; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCaPoolCapoolFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCaPoolCapoolFieldmask(); + } + + public static void syncUpdateCaPoolCapoolFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CaPool caPool = CaPool.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CaPool response = + certificateAuthorityServiceClient.updateCaPoolAsync(caPool, updateMask).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecapool_capoolfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java new file mode 100644 index 00000000..7ce54038 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificate(); + } + + public static void asyncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.updateCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java new file mode 100644 index 00000000..59254c2a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + syncUpdateCertificate(); + } + + public static void syncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Certificate response = certificateAuthorityServiceClient.updateCertificate(request); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java new file mode 100644 index 00000000..8edbfe11 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_certificatefieldmask_sync] +import com.google.cloud.security.privateca.v1.Certificate; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateCertificateFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateCertificateFieldmask(); + } + + public static void syncUpdateCertificateCertificateFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + Certificate certificate = Certificate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Certificate response = + certificateAuthorityServiceClient.updateCertificate(certificate, updateMask); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificate_certificatefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java new file mode 100644 index 00000000..1661d41c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateAuthority(); + } + + public static void asyncUpdateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .updateCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java new file mode 100644 index 00000000..40dc20f5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateAuthorityLRO(); + } + + public static void asyncUpdateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .updateCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java new file mode 100644 index 00000000..97224aa6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.UpdateCertificateAuthorityRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateAuthority(); + } + + public static void syncUpdateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.updateCertificateAuthorityAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java new file mode 100644 index 00000000..9302e2ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_certificateauthorityfieldmask_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthority; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateAuthorityCertificateauthorityFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateAuthorityCertificateauthorityFieldmask(); + } + + public static void syncUpdateCertificateAuthorityCertificateauthorityFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateAuthority response = + certificateAuthorityServiceClient + .updateCertificateAuthorityAsync(certificateAuthority, updateMask) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificateauthority_certificateauthorityfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java new file mode 100644 index 00000000..e7157f15 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateRevocationList { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateRevocationList(); + } + + public static void asyncUpdateCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .updateCertificateRevocationListCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java new file mode 100644 index 00000000..26938466 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateRevocationListLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateRevocationListLRO(); + } + + public static void asyncUpdateCertificateRevocationListLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .updateCertificateRevocationListOperationCallable() + .futureCall(request); + // Do something. + CertificateRevocationList response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java new file mode 100644 index 00000000..ebadcc6f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1.UpdateCertificateRevocationListRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateRevocationList { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateRevocationList(); + } + + public static void syncUpdateCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateRevocationList response = + certificateAuthorityServiceClient.updateCertificateRevocationListAsync(request).get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java new file mode 100644 index 00000000..16174a37 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_certificaterevocationlistfieldmask_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateRevocationList; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateRevocationListCertificaterevocationlistFieldmask(); + } + + public static void syncUpdateCertificateRevocationListCertificaterevocationlistFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateRevocationList response = + certificateAuthorityServiceClient + .updateCertificateRevocationListAsync(certificateRevocationList, updateMask) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_certificaterevocationlistfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplate.java new file mode 100644 index 00000000..0d0c3814 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateTemplate { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateTemplate(); + } + + public static void asyncUpdateCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateTemplateRequest request = + UpdateCertificateTemplateRequest.newBuilder() + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.updateCertificateTemplateCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplateLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplateLRO.java new file mode 100644 index 00000000..e5575766 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/AsyncUpdateCertificateTemplateLRO.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.OperationMetadata; +import com.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateTemplateLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateTemplateLRO(); + } + + public static void asyncUpdateCertificateTemplateLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateTemplateRequest request = + UpdateCertificateTemplateRequest.newBuilder() + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .updateCertificateTemplateOperationCallable() + .futureCall(request); + // Do something. + CertificateTemplate response = future.get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplate.java new file mode 100644 index 00000000..8562685d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.cloud.security.privateca.v1.UpdateCertificateTemplateRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateTemplate { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateTemplate(); + } + + public static void syncUpdateCertificateTemplate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateTemplateRequest request = + UpdateCertificateTemplateRequest.newBuilder() + .setCertificateTemplate(CertificateTemplate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateTemplate response = + certificateAuthorityServiceClient.updateCertificateTemplateAsync(request).get(); + } + } +} +// [END privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplateCertificatetemplateFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplateCertificatetemplateFieldmask.java new file mode 100644 index 00000000..17fe3f9b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityserviceclient/updatecertificatetemplate/SyncUpdateCertificateTemplateCertificatetemplateFieldmask.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.security.privateca.v1.samples; + +// [START +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_certificatetemplatefieldmask_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1.CertificateTemplate; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateTemplateCertificatetemplateFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateTemplateCertificatetemplateFieldmask(); + } + + public static void syncUpdateCertificateTemplateCertificatetemplateFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateTemplate certificateTemplate = CertificateTemplate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateTemplate response = + certificateAuthorityServiceClient + .updateCertificateTemplateAsync(certificateTemplate, updateMask) + .get(); + } + } +} +// [END +// privateca_v1_generated_certificateauthorityserviceclient_updatecertificatetemplate_certificatetemplatefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..29205701 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.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.security.privateca.v1.samples; + +// [START privateca_v1_generated_certificateauthorityservicesettings_createcertificate_sync] +import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceSettings; +import java.time.Duration; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceSettings.Builder certificateAuthorityServiceSettingsBuilder = + CertificateAuthorityServiceSettings.newBuilder(); + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .setRetrySettings( + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + certificateAuthorityServiceSettingsBuilder.build(); + } +} +// [END privateca_v1_generated_certificateauthorityservicesettings_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..90463782 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.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.security.privateca.v1.stub.samples; + +// [START privateca_v1_generated_certificateauthorityservicestubsettings_createcertificate_sync] +import com.google.cloud.security.privateca.v1.stub.CertificateAuthorityServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceStubSettings.Builder certificateAuthorityServiceSettingsBuilder = + CertificateAuthorityServiceStubSettings.newBuilder(); + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .setRetrySettings( + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateAuthorityServiceStubSettings certificateAuthorityServiceSettings = + certificateAuthorityServiceSettingsBuilder.build(); + } +} +// [END privateca_v1_generated_certificateauthorityservicestubsettings_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java new file mode 100644 index 00000000..8cb8e902 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthority.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.SubordinateConfig; +import com.google.longrunning.Operation; + +public class AsyncActivateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncActivateCertificateAuthority(); + } + + public static void asyncActivateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .activateCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.java new file mode 100644 index 00000000..8cd87ea4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/AsyncActivateCertificateAuthorityLRO.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.SubordinateConfig; + +public class AsyncActivateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncActivateCertificateAuthorityLRO(); + } + + public static void asyncActivateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .activateCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.java new file mode 100644 index 00000000..a01fc3ad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.ActivateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.SubordinateConfig; + +public class SyncActivateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthority(); + } + + public static void syncActivateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ActivateCertificateAuthorityRequest request = + ActivateCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPemCaCertificate("pemCaCertificate2100567073") + .setSubordinateConfig(SubordinateConfig.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..5b5d5b4f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncActivateCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthorityCertificateauthorityname(); + } + + public static void syncActivateCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.java new file mode 100644 index 00000000..702dd8d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/activatecertificateauthority/SyncActivateCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncActivateCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncActivateCertificateAuthorityString(); + } + + public static void syncActivateCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.activateCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_activatecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..6b2cf30c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceSettings; +import com.google.cloud.security.privateca.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..615e5535 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetCredentialsProvider1.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_create_setcredentialsprovider1_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceSettings; + +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. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder() + .setTransportChannelProvider( + CertificateAuthorityServiceSettings.defaultHttpJsonTransportProviderBuilder() + .build()) + .build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..bf598a7d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_create_setendpoint_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceSettings; +import com.google.cloud.security.privateca.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + CertificateAuthorityServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create(certificateAuthorityServiceSettings); + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.java new file mode 100644 index 00000000..3da9c9ee --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/AsyncCreateCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest; + +public class AsyncCreateCertificate { + + public static void main(String[] args) throws Exception { + asyncCreateCertificate(); + } + + public static void asyncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.createCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..5462b0d0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateRequest; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateRequest request = + CreateCertificateRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setCertificateId("certificateId-644529902") + .setCertificate(Certificate.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Certificate response = certificateAuthorityServiceClient.createCertificate(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCertificateauthoritynameCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCertificateauthoritynameCertificateString.java new file mode 100644 index 00000000..0b0c43e3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateCertificateauthoritynameCertificateString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_certificateauthoritynamecertificatestring_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateCertificateauthoritynameCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateCertificateauthoritynameCertificateString(); + } + + public static void syncCreateCertificateCertificateauthoritynameCertificateString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateAuthorityServiceClient.createCertificate(parent, certificate, certificateId); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_certificateauthoritynamecertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.java new file mode 100644 index 00000000..9b1d0bf7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificate/SyncCreateCertificateStringCertificateString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_stringcertificatestring_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncCreateCertificateStringCertificateString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateStringCertificateString(); + } + + public static void syncCreateCertificateStringCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + Certificate certificate = Certificate.newBuilder().build(); + String certificateId = "certificateId-644529902"; + Certificate response = + certificateAuthorityServiceClient.createCertificate(parent, certificate, certificateId); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificate_stringcertificatestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java new file mode 100644 index 00000000..0dbcd149 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthority.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateAuthority(); + } + + public static void asyncCreateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .createCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java new file mode 100644 index 00000000..c8aa81c6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/AsyncCreateCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; + +public class AsyncCreateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncCreateCertificateAuthorityLRO(); + } + + public static void asyncCreateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .createCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.java new file mode 100644 index 00000000..918590f1 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CreateCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncCreateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthority(); + } + + public static void syncCreateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CreateCertificateAuthorityRequest request = + CreateCertificateAuthorityRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setCertificateAuthorityId("certificateAuthorityId-1652580953") + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.createCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityLocationnameCertificateauthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityLocationnameCertificateauthorityString.java new file mode 100644 index 00000000..b4aaf559 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityLocationnameCertificateauthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_locationnamecertificateauthoritystring_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncCreateCertificateAuthorityLocationnameCertificateauthorityString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthorityLocationnameCertificateauthorityString(); + } + + public static void syncCreateCertificateAuthorityLocationnameCertificateauthorityString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + CertificateAuthority response = + certificateAuthorityServiceClient + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_locationnamecertificateauthoritystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.java new file mode 100644 index 00000000..8cb9b1b5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/createcertificateauthority/SyncCreateCertificateAuthorityStringCertificateauthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_stringcertificateauthoritystring_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncCreateCertificateAuthorityStringCertificateauthorityString { + + public static void main(String[] args) throws Exception { + syncCreateCertificateAuthorityStringCertificateauthorityString(); + } + + public static void syncCreateCertificateAuthorityStringCertificateauthorityString() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + String certificateAuthorityId = "certificateAuthorityId-1652580953"; + CertificateAuthority response = + certificateAuthorityServiceClient + .createCertificateAuthorityAsync(parent, certificateAuthority, certificateAuthorityId) + .get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_createcertificateauthority_stringcertificateauthoritystring_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.java new file mode 100644 index 00000000..58bb2953 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncDisableCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncDisableCertificateAuthority(); + } + + public static void asyncDisableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .disableCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java new file mode 100644 index 00000000..7e7eeaf2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/AsyncDisableCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; + +public class AsyncDisableCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncDisableCertificateAuthorityLRO(); + } + + public static void asyncDisableCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .disableCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.java new file mode 100644 index 00000000..46553fa7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.DisableCertificateAuthorityRequest; + +public class SyncDisableCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthority(); + } + + public static void syncDisableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + DisableCertificateAuthorityRequest request = + DisableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..5b05caf5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncDisableCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthorityCertificateauthorityname(); + } + + public static void syncDisableCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.java new file mode 100644 index 00000000..100595fa --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/disablecertificateauthority/SyncDisableCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncDisableCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncDisableCertificateAuthorityString(); + } + + public static void syncDisableCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.disableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_disablecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.java new file mode 100644 index 00000000..c2db684c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncEnableCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncEnableCertificateAuthority(); + } + + public static void asyncEnableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .enableCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java new file mode 100644 index 00000000..3ddf630c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/AsyncEnableCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; + +public class AsyncEnableCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncEnableCertificateAuthorityLRO(); + } + + public static void asyncEnableCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .enableCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.java new file mode 100644 index 00000000..6600ba56 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.EnableCertificateAuthorityRequest; + +public class SyncEnableCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthority(); + } + + public static void syncEnableCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + EnableCertificateAuthorityRequest request = + EnableCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..04148109 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncEnableCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthorityCertificateauthorityname(); + } + + public static void syncEnableCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.java new file mode 100644 index 00000000..8a1c449a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/enablecertificateauthority/SyncEnableCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncEnableCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncEnableCertificateAuthorityString(); + } + + public static void syncEnableCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.enableCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_enablecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.java new file mode 100644 index 00000000..4736bfad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/AsyncFetchCertificateAuthorityCsr.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse; + +public class AsyncFetchCertificateAuthorityCsr { + + public static void main(String[] args) throws Exception { + asyncFetchCertificateAuthorityCsr(); + } + + public static void asyncFetchCertificateAuthorityCsr() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCertificateAuthorityCsrRequest request = + FetchCertificateAuthorityCsrRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .fetchCertificateAuthorityCsrCallable() + .futureCall(request); + // Do something. + FetchCertificateAuthorityCsrResponse response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.java new file mode 100644 index 00000000..36a4662e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsr.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrRequest; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsr { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsr(); + } + + public static void syncFetchCertificateAuthorityCsr() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + FetchCertificateAuthorityCsrRequest request = + FetchCertificateAuthorityCsrRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(request); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.java new file mode 100644 index 00000000..e6fa7283 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsrCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsrCertificateauthorityname(); + } + + public static void syncFetchCertificateAuthorityCsrCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.java new file mode 100644 index 00000000..253b4f60 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/fetchcertificateauthoritycsr/SyncFetchCertificateAuthorityCsrString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.FetchCertificateAuthorityCsrResponse; + +public class SyncFetchCertificateAuthorityCsrString { + + public static void main(String[] args) throws Exception { + syncFetchCertificateAuthorityCsrString(); + } + + public static void syncFetchCertificateAuthorityCsrString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + FetchCertificateAuthorityCsrResponse response = + certificateAuthorityServiceClient.fetchCertificateAuthorityCsr(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_fetchcertificateauthoritycsr_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.java new file mode 100644 index 00000000..1230d43c --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/AsyncGetCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRequest; + +public class AsyncGetCertificate { + + public static void main(String[] args) throws Exception { + asyncGetCertificate(); + } + + public static void asyncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.java new file mode 100644 index 00000000..460134cc --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRequest; + +public class SyncGetCertificate { + + public static void main(String[] args) throws Exception { + syncGetCertificate(); + } + + public static void syncGetCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRequest request = + GetCertificateRequest.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .build(); + Certificate response = certificateAuthorityServiceClient.getCertificate(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.java new file mode 100644 index 00000000..52b6da92 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateCertificatename.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_certificatename_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; + +public class SyncGetCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncGetCertificateCertificatename(); + } + + public static void syncGetCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + Certificate response = certificateAuthorityServiceClient.getCertificate(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.java new file mode 100644 index 00000000..e796c291 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificate/SyncGetCertificateString.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_string_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; + +public class SyncGetCertificateString { + + public static void main(String[] args) throws Exception { + syncGetCertificateString(); + } + + public static void syncGetCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString(); + Certificate response = certificateAuthorityServiceClient.getCertificate(name); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.java new file mode 100644 index 00000000..1cca2bef --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/AsyncGetCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest; + +public class AsyncGetCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncGetCertificateAuthority(); + } + + public static void asyncGetCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getCertificateAuthorityCallable().futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.java new file mode 100644 index 00000000..87cd05f6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.GetCertificateAuthorityRequest; + +public class SyncGetCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthority(); + } + + public static void syncGetCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..bf0fd7b3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncGetCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthorityCertificateauthorityname(); + } + + public static void syncGetCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.java new file mode 100644 index 00000000..e2d7e111 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificateauthority/SyncGetCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncGetCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncGetCertificateAuthorityString(); + } + + public static void syncGetCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.getCertificateAuthority(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java new file mode 100644 index 00000000..6a589c3d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/AsyncGetCertificateRevocationList.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationListName; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest; + +public class AsyncGetCertificateRevocationList { + + public static void main(String[] args) throws Exception { + asyncGetCertificateRevocationList(); + } + + public static void asyncGetCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRevocationListRequest request = + GetCertificateRevocationListRequest.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .getCertificateRevocationListCallable() + .futureCall(request); + // Do something. + CertificateRevocationList response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.java new file mode 100644 index 00000000..3008b317 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationList.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationListName; +import com.google.cloud.security.privateca.v1beta1.GetCertificateRevocationListRequest; + +public class SyncGetCertificateRevocationList { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationList(); + } + + public static void syncGetCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetCertificateRevocationListRequest request = + GetCertificateRevocationListRequest.newBuilder() + .setName( + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString()) + .build(); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(request); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.java new file mode 100644 index 00000000..9ee58555 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListCertificaterevocationlistname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_certificaterevocationlistname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationListName; + +public class SyncGetCertificateRevocationListCertificaterevocationlistname { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationListCertificaterevocationlistname(); + } + + public static void syncGetCertificateRevocationListCertificaterevocationlistname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateRevocationListName name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]"); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_certificaterevocationlistname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.java new file mode 100644 index 00000000..36b52d39 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getcertificaterevocationlist/SyncGetCertificateRevocationListString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationListName; + +public class SyncGetCertificateRevocationListString { + + public static void main(String[] args) throws Exception { + syncGetCertificateRevocationListString(); + } + + public static void syncGetCertificateRevocationListString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateRevocationListName.of( + "[PROJECT]", + "[LOCATION]", + "[CERTIFICATE_AUTHORITY]", + "[CERTIFICATE_REVOCATION_LIST]") + .toString(); + CertificateRevocationList response = + certificateAuthorityServiceClient.getCertificateRevocationList(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getcertificaterevocationlist_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/AsyncGetReusableConfig.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/AsyncGetReusableConfig.java new file mode 100644 index 00000000..06f50b39 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/AsyncGetReusableConfig.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.cloud.security.privateca.v1beta1.ReusableConfigName; + +public class AsyncGetReusableConfig { + + public static void main(String[] args) throws Exception { + asyncGetReusableConfig(); + } + + public static void asyncGetReusableConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetReusableConfigRequest request = + GetReusableConfigRequest.newBuilder() + .setName( + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]").toString()) + .build(); + ApiFuture future = + certificateAuthorityServiceClient.getReusableConfigCallable().futureCall(request); + // Do something. + ReusableConfig response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfig.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfig.java new file mode 100644 index 00000000..93cb53f2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfig.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.GetReusableConfigRequest; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.cloud.security.privateca.v1beta1.ReusableConfigName; + +public class SyncGetReusableConfig { + + public static void main(String[] args) throws Exception { + syncGetReusableConfig(); + } + + public static void syncGetReusableConfig() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + GetReusableConfigRequest request = + GetReusableConfigRequest.newBuilder() + .setName( + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]").toString()) + .build(); + ReusableConfig response = certificateAuthorityServiceClient.getReusableConfig(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigReusableconfigname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigReusableconfigname.java new file mode 100644 index 00000000..4e97c3cf --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigReusableconfigname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_reusableconfigname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.cloud.security.privateca.v1beta1.ReusableConfigName; + +public class SyncGetReusableConfigReusableconfigname { + + public static void main(String[] args) throws Exception { + syncGetReusableConfigReusableconfigname(); + } + + public static void syncGetReusableConfigReusableconfigname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ReusableConfigName name = + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]"); + ReusableConfig response = certificateAuthorityServiceClient.getReusableConfig(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_reusableconfigname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigString.java new file mode 100644 index 00000000..bfc42ee2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/getreusableconfig/SyncGetReusableConfigString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.cloud.security.privateca.v1beta1.ReusableConfigName; + +public class SyncGetReusableConfigString { + + public static void main(String[] args) throws Exception { + syncGetReusableConfigString(); + } + + public static void syncGetReusableConfigString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + ReusableConfigName.of("[PROJECT]", "[LOCATION]", "[REUSABLE_CONFIG]").toString(); + ReusableConfig response = certificateAuthorityServiceClient.getReusableConfig(name); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_getreusableconfig_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java new file mode 100644 index 00000000..432d0a3d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthorities.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class AsyncListCertificateAuthorities { + + public static void main(String[] args) throws Exception { + asyncListCertificateAuthorities(); + } + + public static void asyncListCertificateAuthorities() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .listCertificateAuthoritiesPagedCallable() + .futureCall(request); + // Do something. + for (CertificateAuthority element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.java new file mode 100644 index 00000000..0b511366 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/AsyncListCertificateAuthoritiesPaged.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_paged_async] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesResponse; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListCertificateAuthoritiesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateAuthoritiesPaged(); + } + + public static void asyncListCertificateAuthoritiesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateAuthoritiesResponse response = + certificateAuthorityServiceClient.listCertificateAuthoritiesCallable().call(request); + for (CertificateAuthority element : response.getCertificateAuthoritiesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.java new file mode 100644 index 00000000..5dbc8560 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthorities.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificateAuthoritiesRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncListCertificateAuthorities { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthorities(); + } + + public static void syncListCertificateAuthorities() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateAuthoritiesRequest request = + ListCertificateAuthoritiesRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesLocationname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesLocationname.java new file mode 100644 index 00000000..f5b658df --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesLocationname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_locationname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncListCertificateAuthoritiesLocationname { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthoritiesLocationname(); + } + + public static void syncListCertificateAuthoritiesLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.java new file mode 100644 index 00000000..33386f35 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificateauthorities/SyncListCertificateAuthoritiesString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; + +public class SyncListCertificateAuthoritiesString { + + public static void main(String[] args) throws Exception { + syncListCertificateAuthoritiesString(); + } + + public static void syncListCertificateAuthoritiesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (CertificateAuthority element : + certificateAuthorityServiceClient.listCertificateAuthorities(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificateauthorities_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.java new file mode 100644 index 00000000..9ea40437 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationLists.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest; + +public class AsyncListCertificateRevocationLists { + + public static void main(String[] args) throws Exception { + asyncListCertificateRevocationLists(); + } + + public static void asyncListCertificateRevocationLists() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .listCertificateRevocationListsPagedCallable() + .futureCall(request); + // Do something. + for (CertificateRevocationList element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java new file mode 100644 index 00000000..3db0e47a --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/AsyncListCertificateRevocationListsPaged.java @@ -0,0 +1,68 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_paged_async] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificateRevocationListsPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificateRevocationListsPaged(); + } + + public static void asyncListCertificateRevocationListsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificateRevocationListsResponse response = + certificateAuthorityServiceClient + .listCertificateRevocationListsCallable() + .call(request); + for (CertificateRevocationList element : response.getCertificateRevocationListsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.java new file mode 100644 index 00000000..b8103098 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationLists.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.ListCertificateRevocationListsRequest; + +public class SyncListCertificateRevocationLists { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationLists(); + } + + public static void syncListCertificateRevocationLists() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificateRevocationListsRequest request = + ListCertificateRevocationListsRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.java new file mode 100644 index 00000000..fdfd9397 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; + +public class SyncListCertificateRevocationListsCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationListsCertificateauthorityname(); + } + + public static void syncListCertificateRevocationListsCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.java new file mode 100644 index 00000000..ea74e479 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificaterevocationlists/SyncListCertificateRevocationListsString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; + +public class SyncListCertificateRevocationListsString { + + public static void main(String[] args) throws Exception { + syncListCertificateRevocationListsString(); + } + + public static void syncListCertificateRevocationListsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + for (CertificateRevocationList element : + certificateAuthorityServiceClient.listCertificateRevocationLists(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificaterevocationlists_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java new file mode 100644 index 00000000..c2390925 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificates.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesRequest; + +public class AsyncListCertificates { + + public static void main(String[] args) throws Exception { + asyncListCertificates(); + } + + public static void asyncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.listCertificatesPagedCallable().futureCall(request); + // Do something. + for (Certificate element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java new file mode 100644 index 00000000..ef4b2cde --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/AsyncListCertificatesPaged.java @@ -0,0 +1,65 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_paged_async] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesRequest; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesResponse; +import com.google.common.base.Strings; + +public class AsyncListCertificatesPaged { + + public static void main(String[] args) throws Exception { + asyncListCertificatesPaged(); + } + + public static void asyncListCertificatesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListCertificatesResponse response = + certificateAuthorityServiceClient.listCertificatesCallable().call(request); + for (Certificate element : response.getCertificatesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.java new file mode 100644 index 00000000..52d97866 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificates.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListCertificatesRequest; + +public class SyncListCertificates { + + public static void main(String[] args) throws Exception { + syncListCertificates(); + } + + public static void syncListCertificates() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListCertificatesRequest request = + ListCertificatesRequest.newBuilder() + .setParent( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCertificateauthorityname.java new file mode 100644 index 00000000..05f30dc2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncListCertificatesCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncListCertificatesCertificateauthorityname(); + } + + public static void syncListCertificatesCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.java new file mode 100644 index 00000000..98b42102 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listcertificates/SyncListCertificatesString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_string_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncListCertificatesString { + + public static void main(String[] args) throws Exception { + syncListCertificatesString(); + } + + public static void syncListCertificatesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + for (Certificate element : + certificateAuthorityServiceClient.listCertificates(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listcertificates_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigs.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigs.java new file mode 100644 index 00000000..391385e6 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigs.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; + +public class AsyncListReusableConfigs { + + public static void main(String[] args) throws Exception { + asyncListReusableConfigs(); + } + + public static void asyncListReusableConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListReusableConfigsRequest request = + ListReusableConfigsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.listReusableConfigsPagedCallable().futureCall(request); + // Do something. + for (ReusableConfig element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigsPaged.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigsPaged.java new file mode 100644 index 00000000..200677eb --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/AsyncListReusableConfigsPaged.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_paged_async] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsResponse; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; +import com.google.common.base.Strings; + +public class AsyncListReusableConfigsPaged { + + public static void main(String[] args) throws Exception { + asyncListReusableConfigsPaged(); + } + + public static void asyncListReusableConfigsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListReusableConfigsRequest request = + ListReusableConfigsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + while (true) { + ListReusableConfigsResponse response = + certificateAuthorityServiceClient.listReusableConfigsCallable().call(request); + for (ReusableConfig element : response.getReusableConfigsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigs.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigs.java new file mode 100644 index 00000000..b2d7ed64 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigs.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ListReusableConfigsRequest; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; + +public class SyncListReusableConfigs { + + public static void main(String[] args) throws Exception { + syncListReusableConfigs(); + } + + public static void syncListReusableConfigs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ListReusableConfigsRequest request = + ListReusableConfigsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setOrderBy("orderBy-1207110587") + .build(); + for (ReusableConfig element : + certificateAuthorityServiceClient.listReusableConfigs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsLocationname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsLocationname.java new file mode 100644 index 00000000..8b087919 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsLocationname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_locationname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; + +public class SyncListReusableConfigsLocationname { + + public static void main(String[] args) throws Exception { + syncListReusableConfigsLocationname(); + } + + public static void syncListReusableConfigsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (ReusableConfig element : + certificateAuthorityServiceClient.listReusableConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsString.java new file mode 100644 index 00000000..7f131856 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/listreusableconfigs/SyncListReusableConfigsString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.LocationName; +import com.google.cloud.security.privateca.v1beta1.ReusableConfig; + +public class SyncListReusableConfigsString { + + public static void main(String[] args) throws Exception { + syncListReusableConfigsString(); + } + + public static void syncListReusableConfigsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (ReusableConfig element : + certificateAuthorityServiceClient.listReusableConfigs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_listreusableconfigs_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthority.java new file mode 100644 index 00000000..7ac72d38 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncRestoreCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncRestoreCertificateAuthority(); + } + + public static void asyncRestoreCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RestoreCertificateAuthorityRequest request = + RestoreCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .restoreCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthorityLRO.java new file mode 100644 index 00000000..52ff5553 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/AsyncRestoreCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest; + +public class AsyncRestoreCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncRestoreCertificateAuthorityLRO(); + } + + public static void asyncRestoreCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RestoreCertificateAuthorityRequest request = + RestoreCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .restoreCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthority.java new file mode 100644 index 00000000..17a1f4e8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.RestoreCertificateAuthorityRequest; + +public class SyncRestoreCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncRestoreCertificateAuthority(); + } + + public static void syncRestoreCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RestoreCertificateAuthorityRequest request = + RestoreCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.restoreCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..72138019 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncRestoreCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncRestoreCertificateAuthorityCertificateauthorityname(); + } + + public static void syncRestoreCertificateAuthorityCertificateauthorityname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.restoreCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityString.java new file mode 100644 index 00000000..157efdad --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/restorecertificateauthority/SyncRestoreCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncRestoreCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncRestoreCertificateAuthorityString(); + } + + public static void syncRestoreCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.restoreCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_restorecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.java new file mode 100644 index 00000000..bfacfb7f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/AsyncRevokeCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; +import com.google.cloud.security.privateca.v1beta1.RevocationReason; +import com.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest; + +public class AsyncRevokeCertificate { + + public static void main(String[] args) throws Exception { + asyncRevokeCertificate(); + } + + public static void asyncRevokeCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RevokeCertificateRequest request = + RevokeCertificateRequest.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setReason(RevocationReason.forNumber(0)) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.revokeCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.java new file mode 100644 index 00000000..18068cd5 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; +import com.google.cloud.security.privateca.v1beta1.RevocationReason; +import com.google.cloud.security.privateca.v1beta1.RevokeCertificateRequest; + +public class SyncRevokeCertificate { + + public static void main(String[] args) throws Exception { + syncRevokeCertificate(); + } + + public static void syncRevokeCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + RevokeCertificateRequest request = + RevokeCertificateRequest.newBuilder() + .setName( + CertificateName.of( + "[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString()) + .setReason(RevocationReason.forNumber(0)) + .setRequestId("requestId693933066") + .build(); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.java new file mode 100644 index 00000000..05f82ff2 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateCertificatename.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_certificatename_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; + +public class SyncRevokeCertificateCertificatename { + + public static void main(String[] args) throws Exception { + syncRevokeCertificateCertificatename(); + } + + public static void syncRevokeCertificateCertificatename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateName name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]"); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(name); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_certificatename_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.java new file mode 100644 index 00000000..3103a1c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/revokecertificate/SyncRevokeCertificateString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_string_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateName; + +public class SyncRevokeCertificateString { + + public static void main(String[] args) throws Exception { + syncRevokeCertificateString(); + } + + public static void syncRevokeCertificateString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]", "[CERTIFICATE]") + .toString(); + Certificate response = certificateAuthorityServiceClient.revokeCertificate(name); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_revokecertificate_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthority.java new file mode 100644 index 00000000..628609f7 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest; +import com.google.longrunning.Operation; + +public class AsyncScheduleDeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncScheduleDeleteCertificateAuthority(); + } + + public static void asyncScheduleDeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ScheduleDeleteCertificateAuthorityRequest request = + ScheduleDeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .scheduleDeleteCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthorityLRO.java new file mode 100644 index 00000000..76fac327 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/AsyncScheduleDeleteCertificateAuthorityLRO.java @@ -0,0 +1,56 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest; + +public class AsyncScheduleDeleteCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncScheduleDeleteCertificateAuthorityLRO(); + } + + public static void asyncScheduleDeleteCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ScheduleDeleteCertificateAuthorityRequest request = + ScheduleDeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .scheduleDeleteCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthority.java new file mode 100644 index 00000000..f0beb36e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.ScheduleDeleteCertificateAuthorityRequest; + +public class SyncScheduleDeleteCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncScheduleDeleteCertificateAuthority(); + } + + public static void syncScheduleDeleteCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + ScheduleDeleteCertificateAuthorityRequest request = + ScheduleDeleteCertificateAuthorityRequest.newBuilder() + .setName( + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.scheduleDeleteCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityCertificateauthorityname.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityCertificateauthorityname.java new file mode 100644 index 00000000..5c8d933d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityCertificateauthorityname.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_certificateauthorityname_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncScheduleDeleteCertificateAuthorityCertificateauthorityname { + + public static void main(String[] args) throws Exception { + syncScheduleDeleteCertificateAuthorityCertificateauthorityname(); + } + + public static void syncScheduleDeleteCertificateAuthorityCertificateauthorityname() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthorityName name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]"); + CertificateAuthority response = + certificateAuthorityServiceClient.scheduleDeleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_certificateauthorityname_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityString.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityString.java new file mode 100644 index 00000000..ee8f4313 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/scheduledeletecertificateauthority/SyncScheduleDeleteCertificateAuthorityString.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_string_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityName; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; + +public class SyncScheduleDeleteCertificateAuthorityString { + + public static void main(String[] args) throws Exception { + syncScheduleDeleteCertificateAuthorityString(); + } + + public static void syncScheduleDeleteCertificateAuthorityString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + String name = + CertificateAuthorityName.of("[PROJECT]", "[LOCATION]", "[CERTIFICATE_AUTHORITY]") + .toString(); + CertificateAuthority response = + certificateAuthorityServiceClient.scheduleDeleteCertificateAuthorityAsync(name).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_scheduledeletecertificateauthority_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.java new file mode 100644 index 00000000..347e854f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/AsyncUpdateCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificate(); + } + + public static void asyncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient.updateCertificateCallable().futureCall(request); + // Do something. + Certificate response = future.get(); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.java new file mode 100644 index 00000000..6361a326 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificate { + + public static void main(String[] args) throws Exception { + syncUpdateCertificate(); + } + + public static void syncUpdateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRequest request = + UpdateCertificateRequest.newBuilder() + .setCertificate(Certificate.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + Certificate response = certificateAuthorityServiceClient.updateCertificate(request); + } + } +} +// [END privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.java new file mode 100644 index 00000000..3bbb6694 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificate/SyncUpdateCertificateCertificateFieldmask.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_certificatefieldmask_sync] +import com.google.cloud.security.privateca.v1beta1.Certificate; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateCertificateFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateCertificateFieldmask(); + } + + public static void syncUpdateCertificateCertificateFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + Certificate certificate = Certificate.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Certificate response = + certificateAuthorityServiceClient.updateCertificate(certificate, updateMask); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificate_certificatefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.java new file mode 100644 index 00000000..dcac67c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateAuthority { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateAuthority(); + } + + public static void asyncUpdateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .updateCertificateAuthorityCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.java new file mode 100644 index 00000000..59ab70c4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/AsyncUpdateCertificateAuthorityLRO.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateAuthorityLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateAuthorityLRO(); + } + + public static void asyncUpdateCertificateAuthorityLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .updateCertificateAuthorityOperationCallable() + .futureCall(request); + // Do something. + CertificateAuthority response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.java new file mode 100644 index 00000000..b2b66405 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthority.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateAuthorityRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateAuthority { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateAuthority(); + } + + public static void syncUpdateCertificateAuthority() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateAuthorityRequest request = + UpdateCertificateAuthorityRequest.newBuilder() + .setCertificateAuthority(CertificateAuthority.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateAuthority response = + certificateAuthorityServiceClient.updateCertificateAuthorityAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.java new file mode 100644 index 00000000..70b72757 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificateauthority/SyncUpdateCertificateAuthorityCertificateauthorityFieldmask.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_certificateauthorityfieldmask_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthority; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateAuthorityCertificateauthorityFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateAuthorityCertificateauthorityFieldmask(); + } + + public static void syncUpdateCertificateAuthorityCertificateauthorityFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateAuthority certificateAuthority = CertificateAuthority.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateAuthority response = + certificateAuthorityServiceClient + .updateCertificateAuthorityAsync(certificateAuthority, updateMask) + .get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificateauthority_certificateauthorityfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.java new file mode 100644 index 00000000..3f82b3d8 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationList.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest; +import com.google.longrunning.Operation; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateRevocationList { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateRevocationList(); + } + + public static void asyncUpdateCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + ApiFuture future = + certificateAuthorityServiceClient + .updateCertificateRevocationListCallable() + .futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.java new file mode 100644 index 00000000..e334c2ea --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/AsyncUpdateCertificateRevocationListLRO.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.OperationMetadata; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateCertificateRevocationListLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateCertificateRevocationListLRO(); + } + + public static void asyncUpdateCertificateRevocationListLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + OperationFuture future = + certificateAuthorityServiceClient + .updateCertificateRevocationListOperationCallable() + .futureCall(request); + // Do something. + CertificateRevocationList response = future.get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_lro_async] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.java new file mode 100644 index 00000000..6ae8a1a3 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationList.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.cloud.security.privateca.v1beta1.UpdateCertificateRevocationListRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateRevocationList { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateRevocationList(); + } + + public static void syncUpdateCertificateRevocationList() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + UpdateCertificateRevocationListRequest request = + UpdateCertificateRevocationListRequest.newBuilder() + .setCertificateRevocationList(CertificateRevocationList.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .setRequestId("requestId693933066") + .build(); + CertificateRevocationList response = + certificateAuthorityServiceClient.updateCertificateRevocationListAsync(request).get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.java new file mode 100644 index 00000000..ade30ded --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityserviceclient/updatecertificaterevocationlist/SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask.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.security.privateca.v1beta1.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_certificaterevocationlistfieldmask_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClient; +import com.google.cloud.security.privateca.v1beta1.CertificateRevocationList; +import com.google.protobuf.FieldMask; + +public class SyncUpdateCertificateRevocationListCertificaterevocationlistFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateCertificateRevocationListCertificaterevocationlistFieldmask(); + } + + public static void syncUpdateCertificateRevocationListCertificaterevocationlistFieldmask() + throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = + CertificateAuthorityServiceClient.create()) { + CertificateRevocationList certificateRevocationList = + CertificateRevocationList.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + CertificateRevocationList response = + certificateAuthorityServiceClient + .updateCertificateRevocationListAsync(certificateRevocationList, updateMask) + .get(); + } + } +} +// [END +// privateca_v1beta1_generated_certificateauthorityserviceclient_updatecertificaterevocationlist_certificaterevocationlistfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..7290d95b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/certificateauthorityservicesettings/createcertificate/SyncCreateCertificate.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.security.privateca.v1beta1.samples; + +// [START privateca_v1beta1_generated_certificateauthorityservicesettings_createcertificate_sync] +import com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceSettings; +import java.time.Duration; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceSettings.Builder certificateAuthorityServiceSettingsBuilder = + CertificateAuthorityServiceSettings.newBuilder(); + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .setRetrySettings( + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateAuthorityServiceSettings certificateAuthorityServiceSettings = + certificateAuthorityServiceSettingsBuilder.build(); + } +} +// [END privateca_v1beta1_generated_certificateauthorityservicesettings_createcertificate_sync] diff --git a/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.java new file mode 100644 index 00000000..2f5208af --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/security/privateca/v1beta1/stub/certificateauthorityservicestubsettings/createcertificate/SyncCreateCertificate.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.security.privateca.v1beta1.stub.samples; + +// [START +// privateca_v1beta1_generated_certificateauthorityservicestubsettings_createcertificate_sync] +import com.google.cloud.security.privateca.v1beta1.stub.CertificateAuthorityServiceStubSettings; +import java.time.Duration; + +public class SyncCreateCertificate { + + public static void main(String[] args) throws Exception { + syncCreateCertificate(); + } + + public static void syncCreateCertificate() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + CertificateAuthorityServiceStubSettings.Builder certificateAuthorityServiceSettingsBuilder = + CertificateAuthorityServiceStubSettings.newBuilder(); + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .setRetrySettings( + certificateAuthorityServiceSettingsBuilder + .createCertificateSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + CertificateAuthorityServiceStubSettings certificateAuthorityServiceSettings = + certificateAuthorityServiceSettingsBuilder.build(); + } +} +// [END privateca_v1beta1_generated_certificateauthorityservicestubsettings_createcertificate_sync]