GeezerVison is showing github.com — Update KMS, Language, and Logging folders. (#990) · yugdha/java-docs-samples@93dacde
File treeExpand file treeCollapse file tree Open diff view settings main/java/com/example/language test/java/com/example/language
main/java/com/example/logging test/java/com/example/logging
java/com/example/logging/jul
src/main/java/com/example/logging/logback
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: errorreporting/pom.xml +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,8 +16,8 @@ limitations under the License. | 16 | 16 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 17 | 17 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | 18 | 18 | <modelVersion>4.0.0</modelVersion> | 19 | | - <groupId>com.google.cloud.logging.samples</groupId> | 20 | | - <artifactId>cloud-logging-samples</artifactId> | | 19 | + <groupId>com.google.cloud.errorreporting.samples</groupId> | | 20 | + <artifactId>cloud-errorreporting-samples</artifactId> | 21 | 21 | <packaging>pom</packaging> | 22 | 22 |
| 23 | 23 | <!-- | |
Collapse file Copy file name to clipboardExpand all lines: kms/README.md +3Lines changed: 3 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Cloud Key Management Service | 2 | 2 |
| | 3 | +<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=kms/README.md"> | | 4 | +<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a> | | 5 | + | 3 | 6 | Google [Cloud Key Management Service](https://cloud.google.com/kms/) is a | 4 | 7 | cloud-hosted key management service that lets you manage encryption for your | 5 | 8 | cloud services the same way you do on-premise. You can generate, use, rotate and | |
Collapse file Copy file name to clipboardExpand all lines: kms/pom.xml +13-10Lines changed: 13 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | <artifactId>kms-samples</artifactId> | 6 | 6 | <packaging>jar</packaging> | 7 | 7 |
| | 8 | + <!-- | | 9 | + The parent pom defines common style checks and testing strategies for our samples. | | 10 | + Removing or replacing it should not affect the execution of the samples in anyway. | | 11 | + --> | 8 | 12 | <parent> | 9 | | - <artifactId>doc-samples</artifactId> | 10 | | - <groupId>com.google.cloud</groupId> | 11 | | - <version>1.0.0</version> | 12 | | - <relativePath>..</relativePath> | | 13 | + <groupId>com.google.cloud.samples</groupId> | | 14 | + <artifactId>shared-configuration</artifactId> | | 15 | + <version>1.0.8</version> | 13 | 16 | </parent> | 14 | 17 |
| | 18 | + <properties> | | 19 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | | 20 | + <maven.compiler.target>1.8</maven.compiler.target> | | 21 | + <maven.compiler.source>1.8</maven.compiler.source> | | 22 | + </properties> | | 23 | + | 15 | 24 | <dependencies> | 16 | 25 | <dependency> | 17 | 26 | <groupId>com.google.apis</groupId> | | 60 | 69 | </dependency> | 61 | 70 | </dependencies> | 62 | 71 |
| 63 | | - <properties> | 64 | | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 65 | | - <maven.compiler.source>1.7</maven.compiler.source> | 66 | | - <maven.compiler.target>1.7</maven.compiler.target> | 67 | | - </properties> | 68 | | - | 69 | 72 | <build> | 70 | 73 | <sourceDirectory>src/main/java</sourceDirectory> | 71 | 74 | <plugins> | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/main/java/com/example/CryptFile.java +10-10Lines changed: 10 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | | 25 | 27 | import com.google.api.services.cloudkms.v1.model.DecryptResponse; | 26 | 28 | import com.google.api.services.cloudkms.v1.model.EncryptRequest; | 27 | 29 | import com.google.api.services.cloudkms.v1.model.EncryptResponse; | 28 | | - | | 30 | +import java.io.IOException; | 29 | 31 | import org.kohsuke.args4j.CmdLineException; | 30 | 32 | import org.kohsuke.args4j.CmdLineParser; | 31 | 33 |
| 32 | | -import java.io.IOException; | 33 | | - | 34 | 34 | public class CryptFile { | 35 | 35 |
| 36 | 36 | /** | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/main/java/com/example/CryptFileCommands.java +13-13Lines changed: 13 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | 16 | 18 |
| | 19 | +import java.io.FileOutputStream; | | 20 | +import java.io.IOException; | | 21 | +import java.nio.file.Files; | | 22 | +import java.nio.file.Paths; | 17 | 23 | import org.kohsuke.args4j.Argument; | 18 | 24 | import org.kohsuke.args4j.Option; | 19 | 25 | import org.kohsuke.args4j.spi.SubCommand; | 20 | 26 | import org.kohsuke.args4j.spi.SubCommandHandler; | 21 | 27 | import org.kohsuke.args4j.spi.SubCommands; | 22 | 28 |
| 23 | | -import java.nio.file.Files; | 24 | | -import java.nio.file.Paths; | 25 | | - | 26 | | -import java.io.FileOutputStream; | 27 | | -import java.io.IOException; | 28 | | - | 29 | 29 | /** | 30 | 30 | * Defines the different sub-commands and their parameters, for command-line invocation. | 31 | 31 | */ | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/main/java/com/example/Quickstart.java +15-12Lines changed: 15 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - Copyright 2016, Google, Inc. | 3 | | - Licensed under the Apache License, Version 2.0 (the "License"); | 4 | | - you may not use this file except in compliance with the License. | 5 | | - You may obtain a copy of the License at | 6 | | - http://www.apache.org/licenses/LICENSE-2.0 | 7 | | - Unless required by applicable law or agreed to in writing, software | 8 | | - distributed under the License is distributed on an "AS IS" BASIS, | 9 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 10 | | - See the License for the specific language governing permissions and | 11 | | - limitations under the License. | 12 | | -*/ | | 2 | + * Copyright 2017 Google Inc. | | 3 | + * | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | | 7 | + * | | 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | | 9 | + * | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | | 15 | + */ | 13 | 16 |
| 14 | 17 | package com.example; | 15 | 18 |
| 16 | 19 | // [START kms_quickstart] | 17 | 20 | // Imports the Google Cloud client library | | 21 | + | 18 | 22 | import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; | 19 | 23 | import com.google.api.client.http.HttpTransport; | 20 | 24 | import com.google.api.client.http.javanet.NetHttpTransport; | | 24 | 28 | import com.google.api.services.cloudkms.v1.CloudKMSScopes; | 25 | 29 | import com.google.api.services.cloudkms.v1.model.KeyRing; | 26 | 30 | import com.google.api.services.cloudkms.v1.model.ListKeyRingsResponse; | 27 | | - | 28 | 31 | import java.io.IOException; | 29 | 32 |
| 30 | 33 | public class Quickstart { | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/main/java/com/example/SnippetCommands.java +10-9Lines changed: 10 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | 16 | 18 |
| | 19 | +import java.io.IOException; | 17 | 20 | import org.kohsuke.args4j.Argument; | 18 | 21 | import org.kohsuke.args4j.Option; | 19 | 22 | import org.kohsuke.args4j.spi.SubCommand; | 20 | 23 | import org.kohsuke.args4j.spi.SubCommandHandler; | 21 | 24 | import org.kohsuke.args4j.spi.SubCommands; | 22 | 25 |
| 23 | | -import java.io.IOException; | 24 | | - | 25 | 26 | /** | 26 | 27 | * Defines the different sub-commands and their parameters, for command-line invocation. | 27 | 28 | */ | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/main/java/com/example/Snippets.java +12-12Lines changed: 12 additions & 12 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | | 20 | 22 | import com.google.api.client.json.JsonFactory; | 21 | 23 | import com.google.api.client.json.jackson2.JacksonFactory; | 22 | 24 | import com.google.api.services.cloudkms.v1.CloudKMS; | 23 | | -import com.google.api.services.cloudkms.v1.CloudKMS.Projects.Locations.KeyRings.CryptoKeys.UpdatePrimaryVersion; | 24 | 25 | import com.google.api.services.cloudkms.v1.CloudKMSScopes; | 25 | 26 | import com.google.api.services.cloudkms.v1.model.Binding; | 26 | 27 | import com.google.api.services.cloudkms.v1.model.CryptoKey; | 27 | 28 | import com.google.api.services.cloudkms.v1.model.CryptoKeyVersion; | 28 | 29 | import com.google.api.services.cloudkms.v1.model.DestroyCryptoKeyVersionRequest; | 29 | | -import com.google.api.services.cloudkms.v1.model.RestoreCryptoKeyVersionRequest; | 30 | 30 | import com.google.api.services.cloudkms.v1.model.KeyRing; | 31 | 31 | import com.google.api.services.cloudkms.v1.model.ListCryptoKeyVersionsResponse; | 32 | 32 | import com.google.api.services.cloudkms.v1.model.ListCryptoKeysResponse; | 33 | 33 | import com.google.api.services.cloudkms.v1.model.ListKeyRingsResponse; | 34 | 34 | import com.google.api.services.cloudkms.v1.model.Policy; | | 35 | +import com.google.api.services.cloudkms.v1.model.RestoreCryptoKeyVersionRequest; | 35 | 36 | import com.google.api.services.cloudkms.v1.model.SetIamPolicyRequest; | 36 | 37 | import com.google.api.services.cloudkms.v1.model.UpdateCryptoKeyPrimaryVersionRequest; | 37 | 38 | import java.io.IOException; | @@ -179,8 +180,7 @@ public static CryptoKeyVersion disableCryptoKeyVersion( | 179 | 180 | } | 180 | 181 | // [END kms_disable_cryptokey_version] | 181 | 182 |
| 182 | | - // [START kms_enable_cryptokey_version] | 183 | | - | | 183 | + // [START kms_enable_cryptokey_version] | 184 | 184 | /** | 185 | 185 | * Enables the given version of the crypto key. | 186 | 186 | */ | @@ -563,7 +563,7 @@ public static void listCryptoKeys(String projectId, String locationId, String ke | 563 | 563 | for (CryptoKey key : cryptoKeys.getCryptoKeys()) { | 564 | 564 | System.out.println(key); | 565 | 565 | } | 566 | | - } while(cryptoKeys.getNextPageToken() != null); | | 566 | + } while (cryptoKeys.getNextPageToken() != null); | 567 | 567 | } | 568 | 568 |
| 569 | 569 | /** | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/test/java/com/example/QuickstartIT.java +11-10Lines changed: 11 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | 16 | 18 |
| 17 | 19 | import static com.google.common.truth.Truth.assertThat; | 18 | 20 |
| | 21 | +import java.io.ByteArrayOutputStream; | | 22 | +import java.io.PrintStream; | 19 | 23 | import org.junit.AfterClass; | 20 | 24 | import org.junit.Before; | 21 | 25 | import org.junit.BeforeClass; | 22 | 26 | import org.junit.Test; | 23 | 27 | import org.junit.runner.RunWith; | 24 | 28 | import org.junit.runners.JUnit4; | 25 | 29 |
| 26 | | -import java.io.ByteArrayOutputStream; | 27 | | -import java.io.PrintStream; | 28 | | - | 29 | 30 | /** | 30 | 31 | * Integration (system) tests for {@link Quickstart}. | 31 | 32 | */ | |
Collapse file Copy file name to clipboardExpand all lines: kms/src/test/java/com/example/SnippetsIT.java +9-7Lines changed: 9 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | /* | 2 | | - * Copyright (c) 2017 Google Inc. | | 2 | + * Copyright 2017 Google Inc. | 3 | 3 | * | 4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | 5 | | - * in compliance with the License. You may obtain a copy of the License at | | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | | 5 | + * you may not use this file except in compliance with the License. | | 6 | + * You may obtain a copy of the License at | 6 | 7 | * | 7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | 8 | 9 | * | 9 | | - * Unless required by applicable law or agreed to in writing, software distributed under the License | 10 | | - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | 11 | | - * or implied. See the License for the specific language governing permissions and limitations under | 12 | | - * the License. | | 10 | + * Unless required by applicable law or agreed to in writing, software | | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | 13 | + * See the License for the specific language governing permissions and | | 14 | + * limitations under the License. | 13 | 15 | */ | 14 | 16 |
| 15 | 17 | package com.example; | |
|