Skip to content

Commit 9caff31

Browse files
committed
lint fix
1 parent 6d8386f commit 9caff31

18 files changed

+155
-153
lines changed

privateca/snippets/src/main/java/privateca/ActivateSubordinateCa.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,36 @@ public static void main(String[] args)
3636

3737
// location: For a list of locations, see:
3838
// https://cloud.google.com/certificate-authority-service/docs/locations
39-
// pool_Id: Set a unique id for the CA pool.
39+
// poolId: Set a unique id for the CA pool.
4040
// subordinateCaName: The CA to be activated.
41-
// pemCACertificate: The signed certificate, obtained by signing the CSR.
41+
// pemCaCertificate: The signed certificate, obtained by signing the CSR.
4242
String project = "your-project-id";
4343
String location = "ca-location";
44-
String pool_Id = "ca-pool-id";
44+
String poolId = "ca-pool-id";
4545
String subordinateCaName = "subordinate-certificate-authority-name";
46-
String pemCACertificate =
46+
String pemCaCertificate =
4747
"-----BEGIN CERTIFICATE-----\n" + "sample-pem-certificate\n" + "-----END CERTIFICATE-----";
4848

4949
// certificateAuthorityName: The name of the certificate authority which signed the CSR.
5050
// If an external CA (CA not present in Google Cloud) was used for signing,
5151
// then use the CA's issuerCertificateChain.
5252
String certificateAuthorityName = "certificate-authority-name";
5353

54-
activateSubordinateCA(
55-
project, location, pool_Id, certificateAuthorityName, subordinateCaName, pemCACertificate);
54+
activateSubordinateCa(
55+
project, location, poolId, certificateAuthorityName, subordinateCaName, pemCaCertificate);
5656
}
5757

5858
// Activate a subordinate CA.
5959
// *Prerequisite*: Get the CSR of the subordinate CA signed by another CA. Pass in the signed
6060
// certificate and (issuer CA's name or the issuer CA's Certificate chain).
6161
// *Post*: After activating the subordinate CA, it should be enabled before issuing certificates.
62-
public static void activateSubordinateCA(
62+
public static void activateSubordinateCa(
6363
String project,
6464
String location,
65-
String pool_Id,
65+
String poolId,
6666
String certificateAuthorityName,
6767
String subordinateCaName,
68-
String pemCACertificate)
68+
String pemCaCertificate)
6969
throws ExecutionException, InterruptedException, IOException {
7070
// Initialize client that will be used to send requests. This client only needs to be created
7171
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -75,14 +75,14 @@ public static void activateSubordinateCA(
7575
CertificateAuthorityServiceClient.create()) {
7676
// Subordinate CA parent.
7777
String subordinateCaParent =
78-
CertificateAuthorityName.of(project, location, pool_Id, subordinateCaName).toString();
78+
CertificateAuthorityName.of(project, location, poolId, subordinateCaName).toString();
7979

8080
// Construct the "Activate CA Request".
8181
ActivateCertificateAuthorityRequest activateCertificateAuthorityRequest =
8282
ActivateCertificateAuthorityRequest.newBuilder()
8383
.setName(subordinateCaParent)
8484
// The signed certificate.
85-
.setPemCaCertificate(pemCACertificate)
85+
.setPemCaCertificate(pemCaCertificate)
8686
.setSubordinateConfig(
8787
SubordinateConfig.newBuilder()
8888
// Follow one of the below methods:
@@ -91,7 +91,7 @@ public static void activateSubordinateCA(
9191
// Name.
9292
.setCertificateAuthority(
9393
CertificateAuthorityName.of(
94-
project, location, pool_Id, certificateAuthorityName)
94+
project, location, poolId, certificateAuthorityName)
9595
.toString())
9696

9797
// Method 2: If issuer CA is external to Google Cloud, set the issuer's

privateca/snippets/src/main/java/privateca/CreateCaPool.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ public static void main(String[] args)
3737
// TODO(developer): Replace these variables before running the sample.
3838
// location: For a list of locations, see:
3939
// https://cloud.google.com/certificate-authority-service/docs/locations
40-
// pool_Id: Set a unique pool_Id for the CA pool.
40+
// poolId: Set a unique poolId for the CA pool.
4141
String project = "your-project-id";
4242
String location = "ca-location";
43-
String pool_Id = "ca-pool-id";
44-
createCaPool(project, location, pool_Id);
43+
String poolId = "ca-pool-id";
44+
createCaPool(project, location, poolId);
4545
}
4646

4747
// Create a Certificate Authority Pool. All certificates created under this CA pool will
4848
// follow the same issuance policy, IAM policies,etc.,
49-
public static void createCaPool(String project, String location, String pool_Id)
49+
public static void createCaPool(String project, String location, String poolId)
5050
throws InterruptedException, ExecutionException, IOException {
5151
// Initialize client that will be used to send requests. This client only needs to be created
5252
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -69,7 +69,7 @@ Set the Tier (see: https://cloud.google.com/certificate-authority-service/docs/t
6969
CreateCaPoolRequest caPoolRequest =
7070
CreateCaPoolRequest.newBuilder()
7171
.setParent(LocationName.of(project, location).toString())
72-
.setCaPoolId(pool_Id)
72+
.setCaPoolId(poolId)
7373
.setCaPool(
7474
CaPool.newBuilder()
7575
.setIssuancePolicy(issuancePolicy)
@@ -87,7 +87,7 @@ Set the Tier (see: https://cloud.google.com/certificate-authority-service/docs/t
8787
return;
8888
}
8989

90-
System.out.println("CA pool created successfully: " + pool_Id);
90+
System.out.println("CA pool created successfully: " + poolId);
9191
}
9292
}
9393
}

privateca/snippets/src/main/java/privateca/CreateCertificate.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ public static void main(String[] args)
4848
// publicKeyBytes: Public key used in signing the certificates.
4949
// location: For a list of locations, see:
5050
// https://cloud.google.com/certificate-authority-service/docs/locations
51-
// pool_Id: Set a unique id for the CA pool.
51+
// poolId: Set a unique id for the CA pool.
5252
// certificateAuthorityName: The name of the certificate authority which issues the certificate.
5353
// certificateName: Set a unique name for the certificate.
5454
String project = "your-project-id";
5555
ByteString publicKeyBytes = ByteString.copyFrom(new byte[]{});
5656
String location = "ca-location";
57-
String pool_Id = "ca-pool_Id";
57+
String poolId = "ca-poolId";
5858
String certificateAuthorityName = "certificate-authority-name";
5959
String certificateName = "certificate-name";
6060

6161
createCertificate(
62-
project, location, pool_Id, certificateAuthorityName, certificateName, publicKeyBytes);
62+
project, location, poolId, certificateAuthorityName, certificateName, publicKeyBytes);
6363
}
6464

6565
// Create a Certificate which is issued by the Certificate Authority present in the CA Pool.
@@ -68,7 +68,7 @@ public static void main(String[] args)
6868
public static void createCertificate(
6969
String project,
7070
String location,
71-
String pool_Id,
71+
String poolId,
7272
String certificateAuthorityName,
7373
String certificateName,
7474
ByteString publicKeyBytes)
@@ -134,7 +134,7 @@ public static void createCertificate(
134134
// Create the Certificate Request.
135135
CreateCertificateRequest certificateRequest =
136136
CreateCertificateRequest.newBuilder()
137-
.setParent(CaPoolName.of(project, location, pool_Id).toString())
137+
.setParent(CaPoolName.of(project, location, poolId).toString())
138138
.setCertificateId(certificateName)
139139
.setCertificate(certificate)
140140
.setIssuingCertificateAuthorityId(certificateAuthorityName)

privateca/snippets/src/main/java/privateca/CreateCertificateAuthority.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ public static void main(String[] args)
4444
// TODO(developer): Replace these variables before running the sample.
4545
// location: For a list of locations, see:
4646
// https://cloud.google.com/certificate-authority-service/docs/locations
47-
// pool_Id: Set it to the CA Pool under which the CA should be created.
47+
// poolId: Set it to the CA Pool under which the CA should be created.
4848
// certificateAuthorityName: Unique name for the CA.
4949
String project = "your-project-id";
5050
String location = "ca-location";
51-
String pool_Id = "ca-pool-id";
51+
String poolId = "ca-pool-id";
5252
String certificateAuthorityName = "certificate-authority-name";
53-
createCertificateAuthority(project, location, pool_Id, certificateAuthorityName);
53+
createCertificateAuthority(project, location, poolId, certificateAuthorityName);
5454
}
5555

5656
// Create Certificate Authority which is the root CA in the given CA Pool.
5757
public static void createCertificateAuthority(
58-
String project, String location, String pool_Id, String certificateAuthorityName)
58+
String project, String location, String poolId, String certificateAuthorityName)
5959
throws InterruptedException, ExecutionException, IOException {
6060
// Initialize client that will be used to send requests. This client only needs to be created
6161
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -108,7 +108,7 @@ public static void createCertificateAuthority(
108108
// Create the CertificateAuthorityRequest.
109109
CreateCertificateAuthorityRequest certificateAuthorityRequest =
110110
CreateCertificateAuthorityRequest.newBuilder()
111-
.setParent(CaPoolName.of(project, location, pool_Id).toString())
111+
.setParent(CaPoolName.of(project, location, poolId).toString())
112112
.setCertificateAuthorityId(certificateAuthorityName)
113113
.setCertificateAuthority(certificateAuthority)
114114
.build();

privateca/snippets/src/main/java/privateca/CreateCertificate_CSR.java renamed to privateca/snippets/src/main/java/privateca/CreateCertificateCsr.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,41 @@
2727
import java.io.IOException;
2828
import java.util.concurrent.ExecutionException;
2929

30-
public class CreateCertificate_CSR {
30+
public class CreateCertificateCsr {
3131

3232
public static void main(String[] args)
3333
throws IOException, ExecutionException, InterruptedException {
3434
// TODO(developer): Replace these variables before running the sample.
3535

3636
// location: For a list of locations, see:
3737
// https://cloud.google.com/certificate-authority-service/docs/locations
38-
// pool_Id: Set a unique id for the CA pool.
38+
// poolId: Set a unique id for the CA pool.
3939
// certificateAuthorityName: The name of the certificate authority to sign the CSR.
4040
// certificateName: Set a unique name for the certificate.
41-
// pemCSR: Set the Certificate Issuing Request in the pem encoded format.
41+
// pemCsr: Set the Certificate Issuing Request in the pem encoded format.
4242
String project = "your-project-id";
4343
String location = "ca-location";
44-
String pool_Id = "ca-pool-id";
44+
String poolId = "ca-pool-id";
4545
String certificateAuthorityName = "certificate-authority-name";
4646
String certificateName = "certificate-name";
47-
String pemCSR =
47+
String pemCsr =
4848
"-----BEGIN CERTIFICATE REQUEST-----\n"
4949
+ "sample-pem-csr-format\n"
5050
+ "-----END CERTIFICATE REQUEST-----";
5151

52-
createCertificateWithCSR(
53-
project, location, pool_Id, certificateAuthorityName, certificateName, pemCSR);
52+
createCertificateWithCsr(
53+
project, location, poolId, certificateAuthorityName, certificateName, pemCsr);
5454
}
5555

5656
// Create a Certificate which is issued by the specified Certificate Authority.
5757
// The certificate details and the public key is provided as a CSR (Certificate Signing Request).
58-
public static void createCertificateWithCSR(
58+
public static void createCertificateWithCsr(
5959
String project,
6060
String location,
61-
String pool_Id,
61+
String poolId,
6262
String certificateAuthorityName,
6363
String certificateName,
64-
String pemCSR)
64+
String pemCsr)
6565
throws IOException, ExecutionException, InterruptedException {
6666
// Initialize client that will be used to send requests. This client only needs to be created
6767
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -76,15 +76,15 @@ public static void createCertificateWithCSR(
7676
// The pemCSR contains the public key and the domain details required.
7777
Certificate certificate =
7878
Certificate.newBuilder()
79-
.setPemCsr(pemCSR)
79+
.setPemCsr(pemCsr)
8080
.setLifetime(Duration.newBuilder().setSeconds(certificateLifetime).build())
8181
.build();
8282

8383
// Create the Certificate Request.
8484
// Set the CA which is responsible for creating the certificate with the provided CSR.
8585
CreateCertificateRequest certificateRequest =
8686
CreateCertificateRequest.newBuilder()
87-
.setParent(CaPoolName.of(project, location, pool_Id).toString())
87+
.setParent(CaPoolName.of(project, location, poolId).toString())
8888
.setIssuingCertificateAuthorityId(certificateAuthorityName)
8989
.setCertificateId(certificateName)
9090
.setCertificate(certificate)

privateca/snippets/src/main/java/privateca/CreateSubordinateCa.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ public static void main(String[] args)
4545
// TODO(developer): Replace these variables before running the sample.
4646
// location: For a list of locations, see:
4747
// https://cloud.google.com/certificate-authority-service/docs/locations
48-
// pool_Id: Set it to the CA Pool under which the CA should be created.
48+
// poolId: Set it to the CA Pool under which the CA should be created.
4949
// subordinateCaName: Unique name for the Subordinate CA.
5050
String project = "your-project-id";
5151
String location = "ca-location";
52-
String pool_Id = "ca-pool-id";
52+
String poolId = "ca-pool-id";
5353
String subordinateCaName = "subordinate-certificate-authority-name";
5454

55-
createSubordinateCertificateAuthority(project, location, pool_Id, subordinateCaName);
55+
createSubordinateCertificateAuthority(project, location, poolId, subordinateCaName);
5656
}
5757

5858
public static void createSubordinateCertificateAuthority(
59-
String project, String location, String pool_Id, String subordinateCaName)
59+
String project, String location, String poolId, String subordinateCaName)
6060
throws IOException, ExecutionException, InterruptedException {
6161
// Initialize client that will be used to send requests. This client only needs to be created
6262
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -111,7 +111,7 @@ public static void createSubordinateCertificateAuthority(
111111
// Create the CertificateAuthorityRequest.
112112
CreateCertificateAuthorityRequest subCertificateAuthorityRequest =
113113
CreateCertificateAuthorityRequest.newBuilder()
114-
.setParent(CaPoolName.of(project, location, pool_Id).toString())
114+
.setParent(CaPoolName.of(project, location, poolId).toString())
115115
.setCertificateAuthorityId(subordinateCaName)
116116
.setCertificateAuthority(subCertificateAuthority)
117117
.build();

privateca/snippets/src/main/java/privateca/DeleteCaPool.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ public static void main(String[] args)
3434
// TODO(developer): Replace these variables before running the sample.
3535
// location: For a list of locations, see:
3636
// https://cloud.google.com/certificate-authority-service/docs/locations
37-
// pool_Id: The id of the CA pool to be deleted.
37+
// poolId: The id of the CA pool to be deleted.
3838
String project = "your-project-id";
3939
String location = "ca-location";
40-
String pool_Id = "ca-pool-id";
41-
deleteCaPool(project, location, pool_Id);
40+
String poolId = "ca-pool-id";
41+
deleteCaPool(project, location, poolId);
4242
}
4343

44-
// Delete the CA pool as mentioned by the pool_Id.
44+
// Delete the CA pool as mentioned by the poolId.
4545
// Before deleting the pool, all CAs in the pool MUST BE deleted.
46-
public static void deleteCaPool(String project, String location, String pool_Id)
46+
public static void deleteCaPool(String project, String location, String poolId)
4747
throws InterruptedException, ExecutionException, IOException {
4848
// Initialize client that will be used to send requests. This client only needs to be created
4949
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -52,12 +52,12 @@ public static void deleteCaPool(String project, String location, String pool_Id)
5252
try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
5353
CertificateAuthorityServiceClient.create()) {
5454

55-
// Set the project, location and pool_Id to delete.
55+
// Set the project, location and poolId to delete.
5656
CaPoolName caPool =
5757
CaPoolName.newBuilder()
5858
.setProject(project)
5959
.setLocation(location)
60-
.setCaPool(pool_Id)
60+
.setCaPool(poolId)
6161
.build();
6262

6363
// Create the Delete request.
@@ -74,7 +74,7 @@ public static void deleteCaPool(String project, String location, String pool_Id)
7474
return;
7575
}
7676

77-
System.out.println("Deleted CA Pool: " + pool_Id);
77+
System.out.println("Deleted CA Pool: " + poolId);
7878
}
7979
}
8080
}

privateca/snippets/src/main/java/privateca/DeleteCertificateAuthority.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ public static void main(String[] args)
3434
// TODO(developer): Replace these variables before running the sample.
3535
// location: For a list of locations, see:
3636
// https://cloud.google.com/certificate-authority-service/docs/locations
37-
// pool_Id: The id of the CA pool under which the CA is present.
37+
// poolId: The id of the CA pool under which the CA is present.
3838
// certificateAuthorityName: The name of the CA to be deleted.
3939
String project = "your-project-id";
4040
String location = "ca-location";
41-
String pool_Id = "ca-pool-id";
41+
String poolId = "ca-pool-id";
4242
String certificateAuthorityName = "certificate-authority-name";
43-
deleteCertificateAuthority(project, location, pool_Id, certificateAuthorityName);
43+
deleteCertificateAuthority(project, location, poolId, certificateAuthorityName);
4444
}
4545

4646
// Delete the Certificate Authority from the specified CA pool.
4747
// Before deletion, the CA must be disabled and must not contain any active certificates.
4848
public static void deleteCertificateAuthority(
49-
String project, String location, String pool_Id, String certificateAuthorityName)
49+
String project, String location, String poolId, String certificateAuthorityName)
5050
throws IOException, ExecutionException, InterruptedException {
5151
// Initialize client that will be used to send requests. This client only needs to be created
5252
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -59,7 +59,7 @@ public static void deleteCertificateAuthority(
5959
CertificateAuthorityName.newBuilder()
6060
.setProject(project)
6161
.setLocation(location)
62-
.setCaPool(pool_Id)
62+
.setCaPool(poolId)
6363
.setCertificateAuthority(certificateAuthorityName)
6464
.build();
6565

0 commit comments

Comments
 (0)