From 58be6adfd5c0c2f5298b8aa0517c427d72586b62 Mon Sep 17 00:00:00 2001 From: shabirmean Date: Fri, 11 Nov 2022 17:39:27 -0500 Subject: [PATCH 1/2] cleanup: remove migrated sample --- .../contactcenterinsights/CreateAnalysis.java | 51 -------- .../CreateConversation.java | 78 ------------ .../CreateConversationWithTtl.java | 80 ------------- .../CreateIssueModel.java | 59 ---------- .../CreatePhraseMatcherAllOf.java | 96 --------------- .../CreatePhraseMatcherAnyOf.java | 78 ------------ .../EnablePubSubNotifications.java | 65 ---------- .../ExportToBigquery.java | 90 -------------- .../contactcenterinsights/GetOperation.java | 49 -------- .../contactcenterinsights/SetProjectTtl.java | 60 ---------- .../CreateAnalysisIT.java | 110 ----------------- .../CreateConversationIT.java | 76 ------------ .../CreateConversationWithTtlIT.java | 76 ------------ .../CreateIssueModelIT.java | 106 ----------------- .../CreatePhraseMatcherAllOfIT.java | 73 ------------ .../CreatePhraseMatcherAnyOfIT.java | 73 ------------ .../EnablePubSubNotificationsIT.java | 109 ----------------- .../ExportToBigqueryIT.java | 111 ------------------ .../contactcenterinsights/GetOperationIT.java | 79 ------------- .../SetProjectTtlIT.java | 84 ------------- 20 files changed, 1603 deletions(-) delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java delete mode 100644 samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreateAnalysisIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationWithTtlIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreateIssueModelIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOfIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOfIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/EnablePubSubNotificationsIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/ExportToBigqueryIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/GetOperationIT.java delete mode 100644 samples/snippets/src/test/java/com/example/contactcenterinsights/SetProjectTtlIT.java diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java deleted file mode 100644 index 0b4293b9..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_analysis] - -import com.google.cloud.contactcenterinsights.v1.Analysis; -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import java.io.IOException; - -public class CreateAnalysis { - - public static void main(String[] args) throws Exception, IOException { - // TODO(developer): Replace this variable before running the sample. - String conversationName = - "projects/my_project_id/locations/us-central1/conversations/my_conversation_id"; - - createAnalysis(conversationName); - } - - public static Analysis createAnalysis(String conversationName) throws Exception, IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct an analysis. - Analysis analysis = Analysis.newBuilder().build(); - - // Call the Insights client to create an analysis. - Analysis response = client.createAnalysisAsync(conversationName, analysis).get(); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_analysis] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java deleted file mode 100644 index cd03bd15..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_conversation] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Conversation; -import com.google.cloud.contactcenterinsights.v1.ConversationDataSource; -import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; -import com.google.cloud.contactcenterinsights.v1.GcsSource; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import java.io.IOException; - -public class CreateConversation { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "my_project_id"; - String transcriptUri = "gs://cloud-samples-data/ccai/chat_sample.json"; - String audioUri = "gs://cloud-samples-data/ccai/voice_6912.txt"; - - createConversation(projectId, transcriptUri, audioUri); - } - - public static Conversation createConversation( - String projectId, String transcriptUri, String audioUri) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a parent resource. - LocationName parent = LocationName.of(projectId, "us-central1"); - - // Construct a conversation. - Conversation conversation = - Conversation.newBuilder() - .setDataSource( - ConversationDataSource.newBuilder() - .setGcsSource( - GcsSource.newBuilder() - .setTranscriptUri(transcriptUri) - .setAudioUri(audioUri) - .build()) - .build()) - .setMedium(Conversation.Medium.CHAT) - .build(); - - // Construct a request. - CreateConversationRequest request = - CreateConversationRequest.newBuilder() - .setParent(parent.toString()) - .setConversation(conversation) - .build(); - - // Call the Insights client to create a conversation. - Conversation response = client.createConversation(request); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_conversation] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java deleted file mode 100644 index 55649165..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_conversation_with_ttl] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Conversation; -import com.google.cloud.contactcenterinsights.v1.ConversationDataSource; -import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; -import com.google.cloud.contactcenterinsights.v1.GcsSource; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import com.google.protobuf.Duration; -import java.io.IOException; - -public class CreateConversationWithTtl { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "my_project_id"; - String transcriptUri = "gs://cloud-samples-data/ccai/chat_sample.json"; - String audioUri = "gs://cloud-samples-data/ccai/voice_6912.txt"; - - createConversationWithTtl(projectId, transcriptUri, audioUri); - } - - public static Conversation createConversationWithTtl( - String projectId, String transcriptUri, String audioUri) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a parent resource. - LocationName parent = LocationName.of(projectId, "us-central1"); - - // Construct a conversation. - Conversation conversation = - Conversation.newBuilder() - .setDataSource( - ConversationDataSource.newBuilder() - .setGcsSource( - GcsSource.newBuilder() - .setTranscriptUri(transcriptUri) - .setAudioUri(audioUri) - .build()) - .build()) - .setMedium(Conversation.Medium.CHAT) - .setTtl(Duration.newBuilder().setSeconds(86400).build()) - .build(); - - // Construct a request. - CreateConversationRequest request = - CreateConversationRequest.newBuilder() - .setParent(parent.toString()) - .setConversation(conversation) - .build(); - - // Call the Insights client to create a conversation. - Conversation response = client.createConversation(request); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_conversation_with_ttl] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java deleted file mode 100644 index 0a3612b0..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_issue_model] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.IssueModel; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import java.io.IOException; - -public class CreateIssueModel { - - public static void main(String[] args) throws Exception, IOException { - // TODO(developer): Replace this variable before running the sample. - String projectId = "my_project_id"; - - createIssueModel(projectId); - } - - public static IssueModel createIssueModel(String projectId) throws Exception, IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a parent resource. - LocationName parent = LocationName.of(projectId, "us-central1"); - - // Construct an issue model. - IssueModel issueModel = - IssueModel.newBuilder() - .setDisplayName("my-model") - .setInputDataConfig( - IssueModel.InputDataConfig.newBuilder().setFilter("medium=\"CHAT\"").build()) - .build(); - - // Call the Insights client to create an issue model. - IssueModel response = client.createIssueModelAsync(parent, issueModel).get(); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_issue_model] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java deleted file mode 100644 index ec8d75a3..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_phrase_matcher_all_of] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.ExactMatchConfig; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRule; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup; -import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; -import java.io.IOException; - -public class CreatePhraseMatcherAllOf { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace this variable before running the sample. - String projectId = "my_project_id"; - - createPhraseMatcherAllOf(projectId); - } - - public static PhraseMatcher createPhraseMatcherAllOf(String projectId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a phrase matcher that matches all of its rule groups. - PhraseMatcher.Builder phraseMatcher = - PhraseMatcher.newBuilder() - .setDisplayName("NON_SHIPPING_PHONE_SERVICE") - .setTypeValue(1) - .setActive(true); - - // Construct a rule group to match the word "PHONE" or "CELLPHONE", ignoring case sensitivity. - PhraseMatchRuleGroup.Builder ruleGroup1 = PhraseMatchRuleGroup.newBuilder().setTypeValue(2); - - String[] words1 = {"PHONE", "CELLPHONE"}; - for (String w : words1) { - PhraseMatchRule.Builder rule = - PhraseMatchRule.newBuilder() - .setQuery(w) - .setConfig( - PhraseMatchRuleConfig.newBuilder() - .setExactMatchConfig(ExactMatchConfig.newBuilder().build()) - .build()); - ruleGroup1.addPhraseMatchRules(rule.build()); - } - phraseMatcher.addPhraseMatchRuleGroups(ruleGroup1.build()); - - // Construct another rule group to not match the word "SHIPPING" or "DELIVERY", - // ignoring case sensitivity. - PhraseMatchRuleGroup.Builder ruleGroup2 = PhraseMatchRuleGroup.newBuilder().setTypeValue(1); - - String[] words2 = {"SHIPPING", "DELIVERY"}; - for (String w : words2) { - PhraseMatchRule.Builder rule = - PhraseMatchRule.newBuilder() - .setQuery(w) - .setNegated(true) - .setConfig( - PhraseMatchRuleConfig.newBuilder() - .setExactMatchConfig(ExactMatchConfig.newBuilder().build()) - .build()); - ruleGroup2.addPhraseMatchRules(rule.build()); - } - phraseMatcher.addPhraseMatchRuleGroups(ruleGroup2.build()); - - // Construct a parent resource. - LocationName parent = LocationName.of(projectId, "us-central1"); - - // Call the Insights client to create a phrase matcher. - PhraseMatcher response = client.createPhraseMatcher(parent, phraseMatcher.build()); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_phrase_matcher_all_of] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java deleted file mode 100644 index c1d0bcf3..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_create_phrase_matcher_any_of] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.ExactMatchConfig; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRule; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleConfig; -import com.google.cloud.contactcenterinsights.v1.PhraseMatchRuleGroup; -import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; -import java.io.IOException; - -public class CreatePhraseMatcherAnyOf { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace this variable before running the sample. - String projectId = "my_project_id"; - - createPhraseMatcherAnyOf(projectId); - } - - public static PhraseMatcher createPhraseMatcherAnyOf(String projectId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a phrase matcher that matches any of its rule groups. - PhraseMatcher.Builder phraseMatcher = - PhraseMatcher.newBuilder() - .setDisplayName("PHONE_SERVICE") - .setTypeValue(2) - .setActive(true); - - // Construct a rule group to match the word "PHONE" or "CELLPHONE", ignoring case sensitivity. - PhraseMatchRuleGroup.Builder ruleGroup = PhraseMatchRuleGroup.newBuilder().setTypeValue(2); - - String[] words = {"PHONE", "CELLPHONE"}; - for (String w : words) { - PhraseMatchRule.Builder rule = - PhraseMatchRule.newBuilder() - .setQuery(w) - .setConfig( - PhraseMatchRuleConfig.newBuilder() - .setExactMatchConfig(ExactMatchConfig.newBuilder().build()) - .build()); - ruleGroup.addPhraseMatchRules(rule.build()); - } - phraseMatcher.addPhraseMatchRuleGroups(ruleGroup.build()); - - // Construct a parent resource. - LocationName parent = LocationName.of(projectId, "us-central1"); - - // Call the Insights client to create a phrase matcher. - PhraseMatcher response = client.createPhraseMatcher(parent, phraseMatcher.build()); - System.out.printf("Created %s%n", response.getName()); - return response; - } - } -} - -// [END contactcenterinsights_create_phrase_matcher_any_of] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java deleted file mode 100644 index 65189853..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_enable_pubsub_notifications] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Settings; -import com.google.cloud.contactcenterinsights.v1.SettingsName; -import com.google.protobuf.FieldMask; -import java.io.IOException; - -public class EnablePubSubNotifications { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "my_project_id"; - String topicCreateConversation = "projects/my_project_id/topics/my_topic_id"; - String topicCreateAnalysis = "projects/my_project_id/topics/my_other_topic_id"; - - enablePubSubNotifications(projectId, topicCreateConversation, topicCreateAnalysis); - } - - public static void enablePubSubNotifications( - String projectId, String topicCreateConversation, String topicCreateAnalysis) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a settings resource. - SettingsName name = SettingsName.of(projectId, "us-central1"); - Settings settings = - Settings.newBuilder() - .setName(name.toString()) - .putPubsubNotificationSettings("create-conversation", topicCreateConversation) - .putPubsubNotificationSettings("create-analysis", topicCreateAnalysis) - .build(); - - // Construct an update mask. - FieldMask updateMask = - FieldMask.newBuilder().addPaths("pubsub_notification_settings").build(); - - // Call the Insights client to enable Pub/Sub notifications. - Settings response = client.updateSettings(settings, updateMask); - System.out.printf("Enabled Pub/Sub notifications"); - } - } -} - -// [END contactcenterinsights_enable_pubsub_notifications] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java deleted file mode 100644 index c5e8de14..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_export_to_bigquery] - -import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; -import com.google.api.gax.retrying.RetrySettings; -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsSettings; -import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest; -import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import java.io.IOException; -import org.threeten.bp.Duration; - -public class ExportToBigquery { - - public static void main(String[] args) throws Exception, IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "my_project_id"; - String bigqueryProjectId = "my_bigquery_project_id"; - String bigqueryDataset = "my_bigquery_dataset"; - String bigqueryTable = "my_bigquery_table"; - - exportToBigquery(projectId, bigqueryProjectId, bigqueryDataset, bigqueryTable); - } - - public static void exportToBigquery( - String projectId, String bigqueryProjectId, String bigqueryDataset, String bigqueryTable) - throws Exception, IOException { - // Set the operation total polling timeout to 24 hours instead of the 5-minute default. - // Other values are copied from the default values of {@link ContactCenterInsightsStubSettings}. - ContactCenterInsightsSettings.Builder clientSettings = - ContactCenterInsightsSettings.newBuilder(); - clientSettings - .exportInsightsDataOperationSettings() - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(5000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofHours(24L)) - .build())); - - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = - ContactCenterInsightsClient.create(clientSettings.build())) { - // Construct an export request. - LocationName parent = LocationName.of(projectId, "us-central1"); - ExportInsightsDataRequest request = - ExportInsightsDataRequest.newBuilder() - .setParent(parent.toString()) - .setBigQueryDestination( - ExportInsightsDataRequest.BigQueryDestination.newBuilder() - .setProjectId(bigqueryProjectId) - .setDataset(bigqueryDataset) - .setTable(bigqueryTable) - .build()) - .setFilter("agent_id=\"007\"") - .build(); - - // Call the Insights client to export data to BigQuery. - ExportInsightsDataResponse response = client.exportInsightsDataAsync(request).get(); - System.out.printf("Exported data to BigQuery"); - } - } -} - -// [END contactcenterinsights_export_to_bigquery] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java deleted file mode 100644 index 19721bca..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_get_operation] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; -import java.io.IOException; - -public class GetOperation { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace this variable before running the sample. - String operationName = "projects/my_project_id/locations/us-central1/operations/12345"; - - getOperation(operationName); - } - - public static Operation getOperation(String operationName) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - OperationsClient operationsClient = client.getOperationsClient(); - Operation operation = operationsClient.getOperation(operationName); - - System.out.printf("Got operation %s%n", operation.getName()); - return operation; - } - } -} - -// [END contactcenterinsights_get_operation] diff --git a/samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java b/samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java deleted file mode 100644 index 9e4b2a73..00000000 --- a/samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -// [START contactcenterinsights_set_project_ttl] - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Settings; -import com.google.cloud.contactcenterinsights.v1.SettingsName; -import com.google.protobuf.Duration; -import com.google.protobuf.FieldMask; -import java.io.IOException; - -public class SetProjectTtl { - - public static void main(String[] args) throws IOException { - // TODO(developer): Replace this variable before running the sample. - String projectId = "my_project_id"; - - setProjectTtl(projectId); - } - - public static void setProjectTtl(String projectId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Construct a settings resource. - SettingsName name = SettingsName.of(projectId, "us-central1"); - Settings settings = - Settings.newBuilder() - .setName(name.toString()) - .setConversationTtl(Duration.newBuilder().setSeconds(86400).build()) - .build(); - - // Construct an update mask. - FieldMask updateMask = FieldMask.newBuilder().addPaths("conversation_ttl").build(); - - // Call the Insights client to set a project-level TTL. - Settings response = client.updateSettings(settings, updateMask); - System.out.printf("Set TTL for all incoming conversations to 1 day"); - } - } -} - -// [END contactcenterinsights_set_project_ttl] diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateAnalysisIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateAnalysisIT.java deleted file mode 100644 index 8eb7fd95..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateAnalysisIT.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.Analysis; -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Conversation; -import com.google.cloud.contactcenterinsights.v1.ConversationDataSource; -import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; -import com.google.cloud.contactcenterinsights.v1.DeleteConversationRequest; -import com.google.cloud.contactcenterinsights.v1.GcsSource; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreateAnalysisIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TRANSCRIPT_URI = "gs://cloud-samples-data/ccai/chat_sample.json"; - private static final String AUDIO_URI = "gs://cloud-samples-data/ccai/voice_6912.txt"; - private ByteArrayOutputStream bout; - private PrintStream out; - private String conversationName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - - // Create a conversation. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - LocationName parent = LocationName.of(PROJECT_ID, "us-central1"); - - Conversation conversation = - Conversation.newBuilder() - .setDataSource( - ConversationDataSource.newBuilder() - .setGcsSource( - GcsSource.newBuilder() - .setTranscriptUri(TRANSCRIPT_URI) - .setAudioUri(AUDIO_URI) - .build()) - .build()) - .setMedium(Conversation.Medium.CHAT) - .build(); - - CreateConversationRequest request = - CreateConversationRequest.newBuilder() - .setParent(parent.toString()) - .setConversation(conversation) - .build(); - - Conversation response = client.createConversation(request); - conversationName = response.getName(); - } - } - - @After - public void tearDown() throws Exception, IOException { - // Delete the conversation. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - DeleteConversationRequest request = - DeleteConversationRequest.newBuilder().setName(conversationName).setForce(true).build(); - client.deleteConversation(request); - } - System.setOut(null); - } - - @Test - public void testCreateAnalysis() throws Exception, IOException { - Analysis analysis = CreateAnalysis.createAnalysis(conversationName); - assertThat(bout.toString()).contains(analysis.getName()); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationIT.java deleted file mode 100644 index 894914fe..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationIT.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Conversation; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreateConversationIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TRANSCRIPT_URI = "gs://cloud-samples-data/ccai/chat_sample.json"; - private static final String AUDIO_URI = "gs://cloud-samples-data/ccai/voice_6912.txt"; - private ByteArrayOutputStream bout; - private PrintStream out; - private String conversationName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - client.deleteConversation(conversationName); - } - System.setOut(null); - } - - @Test - public void testCreateConversation() throws IOException { - Conversation conversation = - CreateConversation.createConversation(PROJECT_ID, TRANSCRIPT_URI, AUDIO_URI); - conversationName = conversation.getName(); - assertThat(bout.toString()).contains(conversationName); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationWithTtlIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationWithTtlIT.java deleted file mode 100644 index 349795e6..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateConversationWithTtlIT.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Conversation; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreateConversationWithTtlIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TRANSCRIPT_URI = "gs://cloud-samples-data/ccai/chat_sample.json"; - private static final String AUDIO_URI = "gs://cloud-samples-data/ccai/voice_6912.txt"; - private ByteArrayOutputStream bout; - private PrintStream out; - private String conversationName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - client.deleteConversation(conversationName); - } - System.setOut(null); - } - - @Test - public void testCreateConversationWithTtl() throws IOException { - Conversation conversation = - CreateConversationWithTtl.createConversationWithTtl(PROJECT_ID, TRANSCRIPT_URI, AUDIO_URI); - conversationName = conversation.getName(); - assertThat(bout.toString()).contains(conversationName); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateIssueModelIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateIssueModelIT.java deleted file mode 100644 index 60e4b9be..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreateIssueModelIT.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.IssueModel; -import com.google.cloud.contactcenterinsights.v1.ListConversationsRequest; -import com.google.cloud.contactcenterinsights.v1.ListConversationsResponse; -import com.google.cloud.contactcenterinsights.v1.LocationName; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreateIssueModelIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final int MIN_CONVERSATION_COUNT = 10000; - private ByteArrayOutputStream bout; - private PrintStream out; - private String issueModelName; - private int conversationCount; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - - // Check if the project has the minimum number of conversations required to create - // an issue model. See https://cloud.google.com/contact-center/insights/docs/topic-model. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - LocationName parent = LocationName.of(PROJECT_ID, "us-central1"); - ListConversationsRequest.Builder listRequest = - ListConversationsRequest.newBuilder().setParent(parent.toString()).setPageSize(1000); - - conversationCount = 0; - while (conversationCount < MIN_CONVERSATION_COUNT) { - ListConversationsResponse listResponse = - client.listConversationsCallable().call(listRequest.build()); - - if (listResponse.getConversationsCount() == 0) { - break; - } - conversationCount += listResponse.getConversationsCount(); - - if (listResponse.getNextPageToken().isEmpty()) { - break; - } - listRequest.setPageToken(listResponse.getNextPageToken()); - } - } - } - - @After - public void tearDown() throws Exception, IOException { - if (conversationCount >= MIN_CONVERSATION_COUNT) { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - client.deleteIssueModelAsync(issueModelName); - } - } - System.setOut(null); - } - - @Test - public void testCreateIssueModel() throws Exception, IOException { - if (conversationCount >= MIN_CONVERSATION_COUNT) { - IssueModel issueModel = CreateIssueModel.createIssueModel(PROJECT_ID); - issueModelName = issueModel.getName(); - assertThat(bout.toString()).contains(issueModelName); - } - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOfIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOfIT.java deleted file mode 100644 index 971150d0..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOfIT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreatePhraseMatcherAllOfIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private ByteArrayOutputStream bout; - private PrintStream out; - private String phraseMatcherName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - client.deletePhraseMatcher(phraseMatcherName); - } - System.setOut(null); - } - - @Test - public void testCreatePhraseMatcherAllOf() throws IOException { - PhraseMatcher phraseMatcher = CreatePhraseMatcherAllOf.createPhraseMatcherAllOf(PROJECT_ID); - phraseMatcherName = phraseMatcher.getName(); - assertThat(bout.toString()).contains(phraseMatcherName); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOfIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOfIT.java deleted file mode 100644 index ccea1df8..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOfIT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class CreatePhraseMatcherAnyOfIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private ByteArrayOutputStream bout; - private PrintStream out; - private String phraseMatcherName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - client.deletePhraseMatcher(phraseMatcherName); - } - System.setOut(null); - } - - @Test - public void testCreatePhraseMatcherAnyOf() throws IOException { - PhraseMatcher phraseMatcher = CreatePhraseMatcherAnyOf.createPhraseMatcherAnyOf(PROJECT_ID); - phraseMatcherName = phraseMatcher.getName(); - assertThat(bout.toString()).contains(phraseMatcherName); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/EnablePubSubNotificationsIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/EnablePubSubNotificationsIT.java deleted file mode 100644 index 5e3188c6..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/EnablePubSubNotificationsIT.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Settings; -import com.google.cloud.contactcenterinsights.v1.SettingsName; -import com.google.cloud.pubsub.v1.TopicAdminClient; -import com.google.protobuf.FieldMask; -import com.google.pubsub.v1.Topic; -import com.google.pubsub.v1.TopicName; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class EnablePubSubNotificationsIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private ByteArrayOutputStream bout; - private PrintStream out; - private String conversationTopic; - private String analysisTopic; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - - // Create Pub/Sub topics. - try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { - String conversationTopicId = - String.format("create-conversation-%s", UUID.randomUUID().toString()); - String analysisTopicId = String.format("create-analysis-%s", UUID.randomUUID().toString()); - - conversationTopic = TopicName.of(PROJECT_ID, conversationTopicId).toString(); - analysisTopic = TopicName.of(PROJECT_ID, analysisTopicId).toString(); - String[] topicNames = {conversationTopic, analysisTopic}; - - for (String topicName : topicNames) { - Topic topic = topicAdminClient.createTopic(topicName); - } - } - } - - @After - public void tearDown() throws IOException { - // Disable Pub/Sub notifications. - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - SettingsName name = SettingsName.of(PROJECT_ID, "us-central1"); - Settings settings = - Settings.newBuilder().setName(name.toString()).clearPubsubNotificationSettings().build(); - - FieldMask updateMask = - FieldMask.newBuilder().addPaths("pubsub_notification_settings").build(); - - Settings response = client.updateSettings(settings, updateMask); - } - - // Delete Pub/Sub topics. - try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) { - topicAdminClient.deleteTopic(conversationTopic); - topicAdminClient.deleteTopic(analysisTopic); - } - System.setOut(null); - } - - @Test - public void testEnablePubSubNotifications() throws IOException { - EnablePubSubNotifications.enablePubSubNotifications( - PROJECT_ID, conversationTopic, analysisTopic); - assertThat(bout.toString()).contains("Enabled Pub/Sub notifications"); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/ExportToBigqueryIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/ExportToBigqueryIT.java deleted file mode 100644 index a7b68acf..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/ExportToBigqueryIT.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.bigquery.BigQuery; -import com.google.cloud.bigquery.BigQueryException; -import com.google.cloud.bigquery.BigQueryOptions; -import com.google.cloud.bigquery.Dataset; -import com.google.cloud.bigquery.DatasetId; -import com.google.cloud.bigquery.DatasetInfo; -import com.google.cloud.bigquery.Schema; -import com.google.cloud.bigquery.StandardTableDefinition; -import com.google.cloud.bigquery.Table; -import com.google.cloud.bigquery.TableDefinition; -import com.google.cloud.bigquery.TableId; -import com.google.cloud.bigquery.TableInfo; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class ExportToBigqueryIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String BIGQUERY_PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String GCLOUD_TESTS_PREFIX = "java_samples_tests"; - private ByteArrayOutputStream bout; - private PrintStream out; - private String bigqueryDatasetId; - private String bigqueryTableId; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() throws BigQueryException { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - - // Generate BigQuery table and dataset IDs. - bigqueryDatasetId = - String.format("%s_%s", GCLOUD_TESTS_PREFIX, UUID.randomUUID().toString().replace("-", "_")); - bigqueryTableId = - String.format("%s_%s", GCLOUD_TESTS_PREFIX, UUID.randomUUID().toString().replace("-", "_")); - - // Create a BigQuery dataset. - BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); - DatasetInfo datasetInfo = - DatasetInfo.newBuilder(DatasetId.of(BIGQUERY_PROJECT_ID, bigqueryDatasetId)).build(); - Dataset dataset = bigquery.create(datasetInfo); - - // Create a BigQuery table under the created dataset. - Schema schema = Schema.of(new ArrayList<>()); - TableDefinition tableDefinition = StandardTableDefinition.of(schema); - TableInfo tableInfo = - TableInfo.newBuilder(TableId.of(bigqueryDatasetId, bigqueryTableId), tableDefinition) - .build(); - Table table = bigquery.create(tableInfo); - } - - @After - public void tearDown() throws BigQueryException { - // Delete the BigQuery dataset and table. - BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); - boolean success = - bigquery.delete( - DatasetId.of(PROJECT_ID, bigqueryDatasetId), - BigQuery.DatasetDeleteOption.deleteContents()); - System.setOut(null); - } - - @Test - public void testExportToBigquery() throws Exception, IOException { - ExportToBigquery.exportToBigquery( - PROJECT_ID, BIGQUERY_PROJECT_ID, bigqueryDatasetId, bigqueryTableId); - assertThat(bout.toString()).contains("Exported data to BigQuery"); - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/GetOperationIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/GetOperationIT.java deleted file mode 100644 index 17e9abdb..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/GetOperationIT.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.api.gax.rpc.ApiException; -import com.google.longrunning.Operation; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class GetOperationIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private ByteArrayOutputStream bout; - private PrintStream out; - private String conversationName; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - System.setOut(null); - } - - @Test - public void testGetOperation() throws IOException { - // TODO(developer): Replace this variable with your operation name. - String operationName = - String.format("projects/%s/locations/us-central1/operations/12345", PROJECT_ID); - - try { - Operation operation = GetOperation.getOperation(operationName); - assertThat(bout.toString()).contains(operation.getName()); - } catch (ApiException exception) { - if (!exception.getMessage().contains("not found")) { - throw exception; - } - } - } -} diff --git a/samples/snippets/src/test/java/com/example/contactcenterinsights/SetProjectTtlIT.java b/samples/snippets/src/test/java/com/example/contactcenterinsights/SetProjectTtlIT.java deleted file mode 100644 index adb973d3..00000000 --- a/samples/snippets/src/test/java/com/example/contactcenterinsights/SetProjectTtlIT.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.contactcenterinsights; - -import static com.google.common.truth.Truth.assertThat; -import static junit.framework.TestCase.assertNotNull; - -import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; -import com.google.cloud.contactcenterinsights.v1.Settings; -import com.google.cloud.contactcenterinsights.v1.SettingsName; -import com.google.protobuf.Duration; -import com.google.protobuf.FieldMask; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -@RunWith(JUnit4.class) -public class SetProjectTtlIT { - - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private ByteArrayOutputStream bout; - private PrintStream out; - - private static void requireEnvVar(String varName) { - assertNotNull(String.format(varName), String.format(varName)); - } - - @BeforeClass - public static void checkRequirements() { - requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS"); - requireEnvVar("GOOGLE_CLOUD_PROJECT"); - } - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - try (ContactCenterInsightsClient client = ContactCenterInsightsClient.create()) { - // Clear project-level TTL. - SettingsName name = SettingsName.of(PROJECT_ID, "us-central1"); - Settings settings = - Settings.newBuilder() - .setName(name.toString()) - .setConversationTtl(Duration.newBuilder().build()) - .build(); - - FieldMask updateMask = FieldMask.newBuilder().addPaths("conversation_ttl").build(); - - Settings response = client.updateSettings(settings, updateMask); - } - System.setOut(null); - } - - @Test - public void testSetProjecTtl() throws IOException { - SetProjectTtl.setProjectTtl(PROJECT_ID); - assertThat(bout.toString()).contains("Set TTL for all incoming conversations to 1 day"); - } -} From 3a992108dc0939d64f4ad2a73472925e179e7d25 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 11 Nov 2022 22:42:24 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 5d439092..f5bcc767 100644 --- a/README.md +++ b/README.md @@ -19,20 +19,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-contact-center-insights - 2.3.9 + 2.5.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-contact-center-insights:2.3.9' +implementation 'com.google.cloud:google-cloud-contact-center-insights:2.5.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-contact-center-insights" % "2.3.9" +libraryDependencies += "com.google.cloud" % "google-cloud-contact-center-insights" % "2.5.0" ``` ## Authentication @@ -70,24 +70,6 @@ use this CCAI Insights Client Library. -## Samples - -Samples are in the [`samples/`](https://github.com/googleapis/java-contact-center-insights/tree/main/samples) directory. - -| Sample | Source Code | Try it | -| --------------------------- | --------------------------------- | ------ | -| Create Analysis | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreateAnalysis.java) | -| Create Conversation | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversation.java) | -| Create Conversation With Ttl | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreateConversationWithTtl.java) | -| Create Issue Model | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreateIssueModel.java) | -| Create Phrase Matcher All Of | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAllOf.java) | -| Create Phrase Matcher Any Of | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/CreatePhraseMatcherAnyOf.java) | -| Enable Pub Sub Notifications | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/EnablePubSubNotifications.java) | -| Export To Bigquery | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/ExportToBigquery.java) | -| Get Operation | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/GetOperation.java) | -| Set Project Ttl | [source code](https://github.com/googleapis/java-contact-center-insights/blob/main/samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-contact-center-insights&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/contactcenterinsights/SetProjectTtl.java) | - - ## Troubleshooting