From 96141a11fdba3dcb2a77a261505583bba75fcc77 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 02:38:25 +0000 Subject: [PATCH] feat(v3beta1): add advanced settings for agent level (#138) PiperOrigin-RevId: 387851191 Source-Link: https://github.com/googleapis/googleapis/commit/5af6d9bdecafdf82534592e41d8c7b16ecee1915 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d323f766c0c6406e6a7bfae91ebaefb0819a3681 feat(v3beta1): add rollout config, state and failure reason for experiment feat(v3beta1): add insights export settings for security setting feat(v3beta1): add language code for streaming recognition result and flow versions for query parameters docs(v3beta1): deprecate legacy logging settings --- google/cloud/dialogflowcx_v3beta1/__init__.py | 6 ++ .../services/agents/async_client.py | 1 + .../services/agents/client.py | 1 + .../services/sessions/async_client.py | 2 + .../services/sessions/client.py | 18 ++++ .../dialogflowcx_v3beta1/types/__init__.py | 6 ++ .../types/advanced_settings.py | 57 ++++++++++++ .../cloud/dialogflowcx_v3beta1/types/agent.py | 17 +++- .../dialogflowcx_v3beta1/types/experiment.py | 92 ++++++++++++++++++- .../types/security_settings.py | 28 +++++- .../dialogflowcx_v3beta1/types/session.py | 12 +++ .../gapic/dialogflowcx_v3beta1/test_agents.py | 1 + .../dialogflowcx_v3beta1/test_experiments.py | 20 ++++ .../dialogflowcx_v3beta1/test_sessions.py | 64 +++++++++---- 14 files changed, 300 insertions(+), 25 deletions(-) create mode 100644 google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py diff --git a/google/cloud/dialogflowcx_v3beta1/__init__.py b/google/cloud/dialogflowcx_v3beta1/__init__.py index b89fa426..6ce4a51b 100644 --- a/google/cloud/dialogflowcx_v3beta1/__init__.py +++ b/google/cloud/dialogflowcx_v3beta1/__init__.py @@ -43,6 +43,7 @@ from .services.webhooks import WebhooksClient from .services.webhooks import WebhooksAsyncClient +from .types.advanced_settings import AdvancedSettings from .types.agent import Agent from .types.agent import AgentValidationResult from .types.agent import CreateAgentRequest @@ -94,6 +95,8 @@ from .types.experiment import GetExperimentRequest from .types.experiment import ListExperimentsRequest from .types.experiment import ListExperimentsResponse +from .types.experiment import RolloutConfig +from .types.experiment import RolloutState from .types.experiment import StartExperimentRequest from .types.experiment import StopExperimentRequest from .types.experiment import UpdateExperimentRequest @@ -247,6 +250,7 @@ "TransitionRouteGroupsAsyncClient", "VersionsAsyncClient", "WebhooksAsyncClient", + "AdvancedSettings", "Agent", "AgentValidationResult", "AgentsClient", @@ -386,6 +390,8 @@ "ResourceName", "ResponseMessage", "RestoreAgentRequest", + "RolloutConfig", + "RolloutState", "RunContinuousTestMetadata", "RunContinuousTestRequest", "RunContinuousTestResponse", diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py index d2de4d33..4c832ba8 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py @@ -29,6 +29,7 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.dialogflowcx_v3beta1.services.agents import pagers +from google.cloud.dialogflowcx_v3beta1.types import advanced_settings from google.cloud.dialogflowcx_v3beta1.types import agent from google.cloud.dialogflowcx_v3beta1.types import agent as gcdc_agent from google.cloud.dialogflowcx_v3beta1.types import flow diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/client.py b/google/cloud/dialogflowcx_v3beta1/services/agents/client.py index 4743fa8e..f406d861 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/client.py @@ -33,6 +33,7 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.dialogflowcx_v3beta1.services.agents import pagers +from google.cloud.dialogflowcx_v3beta1.types import advanced_settings from google.cloud.dialogflowcx_v3beta1.types import agent from google.cloud.dialogflowcx_v3beta1.types import agent as gcdc_agent from google.cloud.dialogflowcx_v3beta1.types import flow diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py index 855a00e9..74d67bc8 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py @@ -75,6 +75,8 @@ class SessionsAsyncClient: parse_transition_route_group_path = staticmethod( SessionsClient.parse_transition_route_group_path ) + version_path = staticmethod(SessionsClient.version_path) + parse_version_path = staticmethod(SessionsClient.parse_version_path) webhook_path = staticmethod(SessionsClient.webhook_path) parse_webhook_path = staticmethod(SessionsClient.parse_webhook_path) common_billing_account_path = staticmethod( diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py index ad1d8133..5a896517 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py @@ -296,6 +296,24 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def version_path( + project: str, location: str, agent: str, flow: str, version: str, + ) -> str: + """Returns a fully-qualified version string.""" + return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( + project=project, location=location, agent=agent, flow=flow, version=version, + ) + + @staticmethod + def parse_version_path(path: str) -> Dict[str, str]: + """Parses a version path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/agents/(?P.+?)/flows/(?P.+?)/versions/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: """Returns a fully-qualified webhook string.""" diff --git a/google/cloud/dialogflowcx_v3beta1/types/__init__.py b/google/cloud/dialogflowcx_v3beta1/types/__init__.py index c083e5b6..b0518a2d 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/__init__.py +++ b/google/cloud/dialogflowcx_v3beta1/types/__init__.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .advanced_settings import AdvancedSettings from .agent import ( Agent, AgentValidationResult, @@ -73,6 +74,8 @@ GetExperimentRequest, ListExperimentsRequest, ListExperimentsResponse, + RolloutConfig, + RolloutState, StartExperimentRequest, StopExperimentRequest, UpdateExperimentRequest, @@ -235,6 +238,7 @@ ) __all__ = ( + "AdvancedSettings", "Agent", "AgentValidationResult", "CreateAgentRequest", @@ -286,6 +290,8 @@ "GetExperimentRequest", "ListExperimentsRequest", "ListExperimentsResponse", + "RolloutConfig", + "RolloutState", "StartExperimentRequest", "StopExperimentRequest", "UpdateExperimentRequest", diff --git a/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py b/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py new file mode 100644 index 00000000..c2d4cc87 --- /dev/null +++ b/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.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. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.dialogflow.cx.v3beta1", manifest={"AdvancedSettings",}, +) + + +class AdvancedSettings(proto.Message): + r"""Hierarchical advanced settings for + agent/flow/page/fulfillment/parameter. Settings exposed at lower + level overrides the settings exposed at higher level. + + Hierarchy: Agent->Flow->Page->Fulfillment/Parameter. + + Attributes: + logging_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings.LoggingSettings): + Settings for logging. + Settings for Dialogflow History, Contact Center + messages, StackDriver logs, and speech logging. + Exposed at the following levels: + - Agent level. + """ + + class LoggingSettings(proto.Message): + r"""Define behaviors on logging. + Attributes: + enable_stackdriver_logging (bool): + If true, StackDriver logging is currently + enabled. + enable_interaction_logging (bool): + If true, DF Interaction logging is currently + enabled. + """ + + enable_stackdriver_logging = proto.Field(proto.BOOL, number=2,) + enable_interaction_logging = proto.Field(proto.BOOL, number=3,) + + logging_settings = proto.Field(proto.MESSAGE, number=6, message=LoggingSettings,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/agent.py b/google/cloud/dialogflowcx_v3beta1/types/agent.py index dd156b88..66481bb8 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/agent.py +++ b/google/cloud/dialogflowcx_v3beta1/types/agent.py @@ -15,6 +15,9 @@ # import proto # type: ignore +from google.cloud.dialogflowcx_v3beta1.types import ( + advanced_settings as gcdc_advanced_settings, +) from google.cloud.dialogflowcx_v3beta1.types import flow from google.protobuf import field_mask_pb2 # type: ignore @@ -114,11 +117,18 @@ class Agent(proto.Message): reference for the agent. Format: ``projects//locations//securitySettings/``. enable_stackdriver_logging (bool): - Indicates if stackdriver logging is enabled - for the agent. + Indicates if stackdriver logging is enabled for the agent. + Please use + [agent.advanced_settings][google.cloud.dialogflow.cx.v3beta1.AdvancedSettings.LoggingSettings] + instead. enable_spell_correction (bool): Indicates if automatic spell correction is enabled in detect intent requests. + advanced_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings): + Hierarchical advanced settings for this + agent. The settings exposed at the lower level + overrides the settings exposed at the higher + level. """ name = proto.Field(proto.STRING, number=1,) @@ -135,6 +145,9 @@ class Agent(proto.Message): security_settings = proto.Field(proto.STRING, number=17,) enable_stackdriver_logging = proto.Field(proto.BOOL, number=18,) enable_spell_correction = proto.Field(proto.BOOL, number=20,) + advanced_settings = proto.Field( + proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings, + ) class ListAgentsRequest(proto.Message): diff --git a/google/cloud/dialogflowcx_v3beta1/types/experiment.py b/google/cloud/dialogflowcx_v3beta1/types/experiment.py index 6f154764..04d16542 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/experiment.py +++ b/google/cloud/dialogflowcx_v3beta1/types/experiment.py @@ -25,6 +25,8 @@ manifest={ "Experiment", "VersionVariants", + "RolloutConfig", + "RolloutState", "VariantsHistory", "ListExperimentsRequest", "ListExperimentsResponse", @@ -57,12 +59,26 @@ class Experiment(proto.Message): state (google.cloud.dialogflowcx_v3beta1.types.Experiment.State): The current state of the experiment. Transition triggered by - Expriments.StartExperiment: PENDING->RUNNING. + Experiments.StartExperiment: DRAFT->RUNNING. Transition triggered by - Expriments.CancelExperiment: PENDING->CANCELLED - or RUNNING->CANCELLED. + Experiments.CancelExperiment: DRAFT->DONE or + RUNNING->DONE. definition (google.cloud.dialogflowcx_v3beta1.types.Experiment.Definition): The definition of the experiment. + rollout_config (google.cloud.dialogflowcx_v3beta1.types.RolloutConfig): + The configuration for auto rollout. If set, + there should be exactly two variants in the + experiment (control variant being the default + version of the flow), the traffic allocation for + the non-control variant will gradually increase + to 100% when conditions are met, and eventually + replace the control variant to become the + default version of the flow. + rollout_state (google.cloud.dialogflowcx_v3beta1.types.RolloutState): + State of the auto rollout process. + rollout_failure_reason (str): + The reason why rollout has failed. Should only be set when + state is ROLLOUT_FAILED. result (google.cloud.dialogflowcx_v3beta1.types.Experiment.Result): Inference result of the experiment. create_time (google.protobuf.timestamp_pb2.Timestamp): @@ -90,6 +106,7 @@ class State(proto.Enum): DRAFT = 1 RUNNING = 2 DONE = 3 + ROLLOUT_FAILED = 4 class Definition(proto.Message): r"""Definition of the experiment. @@ -226,6 +243,9 @@ class VersionMetrics(proto.Message): description = proto.Field(proto.STRING, number=3,) state = proto.Field(proto.ENUM, number=4, enum=State,) definition = proto.Field(proto.MESSAGE, number=5, message=Definition,) + rollout_config = proto.Field(proto.MESSAGE, number=14, message="RolloutConfig",) + rollout_state = proto.Field(proto.MESSAGE, number=15, message="RolloutState",) + rollout_failure_reason = proto.Field(proto.STRING, number=16,) result = proto.Field(proto.MESSAGE, number=6, message=Result,) create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) @@ -269,6 +289,72 @@ class Variant(proto.Message): variants = proto.RepeatedField(proto.MESSAGE, number=1, message=Variant,) +class RolloutConfig(proto.Message): + r"""The configuration for auto rollout. + Attributes: + rollout_steps (Sequence[google.cloud.dialogflowcx_v3beta1.types.RolloutConfig.RolloutStep]): + Steps to roll out a flow version. Steps + should be sorted by percentage in ascending + order. + rollout_condition (str): + The conditions that are used to evaluate the success of a + rollout step. If not specified, all rollout steps will + proceed to the next one unless failure conditions are met. + E.g. "containment_rate > 60% AND callback_rate < 20%". See + the `conditions + reference `__. + failure_condition (str): + The conditions that are used to evaluate the failure of a + rollout step. If not specified, no rollout steps will fail. + E.g. "containment_rate < 10% OR average_turn_count < 3". See + the `conditions + reference `__. + """ + + class RolloutStep(proto.Message): + r"""A single rollout step with specified traffic allocation. + Attributes: + display_name (str): + The name of the rollout step; + traffic_percent (int): + The percentage of traffic allocated to the flow version of + this rollout step. (0%, 100%]. + min_duration (google.protobuf.duration_pb2.Duration): + The minimum time that this step should last. + Should be longer than 1 hour. If not set, the + default minimum duration for each step will be 1 + hour. + """ + + display_name = proto.Field(proto.STRING, number=1,) + traffic_percent = proto.Field(proto.INT32, number=2,) + min_duration = proto.Field( + proto.MESSAGE, number=3, message=duration_pb2.Duration, + ) + + rollout_steps = proto.RepeatedField(proto.MESSAGE, number=1, message=RolloutStep,) + rollout_condition = proto.Field(proto.STRING, number=2,) + failure_condition = proto.Field(proto.STRING, number=3,) + + +class RolloutState(proto.Message): + r"""State of the auto-rollout process. + Attributes: + step (str): + Display name of the current auto rollout + step. + step_index (int): + Index of the current step in the auto rollout + steps list. + start_time (google.protobuf.timestamp_pb2.Timestamp): + Start time of the current step. + """ + + step = proto.Field(proto.STRING, number=1,) + step_index = proto.Field(proto.INT32, number=3,) + start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + + class VariantsHistory(proto.Message): r"""The history of variants update. Attributes: diff --git a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py index 140249e6..0a2bdebf 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py +++ b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py @@ -159,8 +159,8 @@ class SecuritySettings(proto.Message): it does not have access to – for example, Cloud logging. inspect_template (str): - DLP inspect template name. Use this template to define - inspect base settings. + `DLP `__ inspect template + name. Use this template to define inspect base settings. If empty, we use the default DLP inspect config. @@ -185,6 +185,14 @@ class SecuritySettings(proto.Message): purge_data_types (Sequence[google.cloud.dialogflowcx_v3beta1.types.SecuritySettings.PurgeDataType]): List of types of data to remove when retention settings triggers purge. + insights_export_settings (google.cloud.dialogflowcx_v3beta1.types.SecuritySettings.InsightsExportSettings): + Optional. Controls conversation exporting settings to + Insights after conversation is completed. + + If + [retention_strategy][google.cloud.dialogflow.cx.v3beta1.SecuritySettings.retention_strategy] + is set to REMOVE_AFTER_CONVERSATION, Insights export is + disabled no matter what you configure here. """ class RedactionStrategy(proto.Enum): @@ -204,6 +212,19 @@ class PurgeDataType(proto.Enum): PURGE_DATA_TYPE_UNSPECIFIED = 0 DIALOGFLOW_HISTORY = 1 + class InsightsExportSettings(proto.Message): + r"""Settings for exporting conversations to + `Insights `__. + + Attributes: + enable_insights_export (bool): + If enabled, we will automatically exports + conversations to Insights and Insights runs its + analyzers. + """ + + enable_insights_export = proto.Field(proto.BOOL, number=1,) + name = proto.Field(proto.STRING, number=1,) display_name = proto.Field(proto.STRING, number=2,) redaction_strategy = proto.Field(proto.ENUM, number=3, enum=RedactionStrategy,) @@ -211,6 +232,9 @@ class PurgeDataType(proto.Enum): inspect_template = proto.Field(proto.STRING, number=9,) retention_window_days = proto.Field(proto.INT32, number=6, oneof="data_retention",) purge_data_types = proto.RepeatedField(proto.ENUM, number=8, enum=PurgeDataType,) + insights_export_settings = proto.Field( + proto.MESSAGE, number=13, message=InsightsExportSettings, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/session.py b/google/cloud/dialogflowcx_v3beta1/types/session.py index 04040b09..ec3147d3 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/session.py +++ b/google/cloud/dialogflowcx_v3beta1/types/session.py @@ -331,6 +331,8 @@ class StreamingRecognitionResult(proto.Message): Time offset of the end of this Speech recognition result relative to the beginning of the audio. Only populated for ``message_type`` = ``TRANSCRIPT``. + language_code (str): + Detected language code for the transcript. """ class MessageType(proto.Enum): @@ -350,6 +352,7 @@ class MessageType(proto.Enum): speech_end_offset = proto.Field( proto.MESSAGE, number=8, message=duration_pb2.Duration, ) + language_code = proto.Field(proto.STRING, number=10,) class QueryParameters(proto.Message): @@ -447,6 +450,14 @@ class QueryParameters(proto.Message): Length", "Connection", "From", "User-Agent", "Accept-Encoding", "If-Modified-Since", "If- None-Match", "X-Forwarded-For", etc. + flow_versions (Sequence[str]): + A list of flow versions to override for the request. Format: + ``projects//locations//agents//flows//versions/``. + + If version 1 of flow X is included in this list, the traffic + of flow X will go through version 1 regardless of the + version configuration in the environment. Each flow can have + at most one version specified in this list. """ time_zone = proto.Field(proto.STRING, number=1,) @@ -460,6 +471,7 @@ class QueryParameters(proto.Message): disable_webhook = proto.Field(proto.BOOL, number=7,) analyze_query_text_sentiment = proto.Field(proto.BOOL, number=8,) webhook_headers = proto.MapField(proto.STRING, proto.STRING, number=10,) + flow_versions = proto.RepeatedField(proto.STRING, number=14,) class QueryInput(proto.Message): diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py index 30d9efa8..ea07958c 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py @@ -41,6 +41,7 @@ from google.cloud.dialogflowcx_v3beta1.services.agents.transports.base import ( _GOOGLE_AUTH_VERSION, ) +from google.cloud.dialogflowcx_v3beta1.types import advanced_settings from google.cloud.dialogflowcx_v3beta1.types import agent from google.cloud.dialogflowcx_v3beta1.types import agent as gcdc_agent from google.cloud.dialogflowcx_v3beta1.types import flow diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py index 4b488a87..9095e1ae 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py @@ -842,6 +842,7 @@ def test_get_experiment( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) response = client.get_experiment(request) @@ -856,6 +857,7 @@ def test_get_experiment( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" def test_get_experiment_from_dict(): @@ -898,6 +900,7 @@ async def test_get_experiment_async( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) ) response = await client.get_experiment(request) @@ -913,6 +916,7 @@ async def test_get_experiment_async( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" @pytest.mark.asyncio @@ -1056,6 +1060,7 @@ def test_create_experiment( display_name="display_name_value", description="description_value", state=gcdc_experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) response = client.create_experiment(request) @@ -1070,6 +1075,7 @@ def test_create_experiment( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == gcdc_experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" def test_create_experiment_from_dict(): @@ -1117,6 +1123,7 @@ async def test_create_experiment_async( display_name="display_name_value", description="description_value", state=gcdc_experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) ) response = await client.create_experiment(request) @@ -1132,6 +1139,7 @@ async def test_create_experiment_async( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == gcdc_experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" @pytest.mark.asyncio @@ -1295,6 +1303,7 @@ def test_update_experiment( display_name="display_name_value", description="description_value", state=gcdc_experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) response = client.update_experiment(request) @@ -1309,6 +1318,7 @@ def test_update_experiment( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == gcdc_experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" def test_update_experiment_from_dict(): @@ -1356,6 +1366,7 @@ async def test_update_experiment_async( display_name="display_name_value", description="description_value", state=gcdc_experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) ) response = await client.update_experiment(request) @@ -1371,6 +1382,7 @@ async def test_update_experiment_async( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == gcdc_experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" @pytest.mark.asyncio @@ -1738,6 +1750,7 @@ def test_start_experiment( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) response = client.start_experiment(request) @@ -1752,6 +1765,7 @@ def test_start_experiment( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" def test_start_experiment_from_dict(): @@ -1794,6 +1808,7 @@ async def test_start_experiment_async( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) ) response = await client.start_experiment(request) @@ -1809,6 +1824,7 @@ async def test_start_experiment_async( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" @pytest.mark.asyncio @@ -1950,6 +1966,7 @@ def test_stop_experiment( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) response = client.stop_experiment(request) @@ -1964,6 +1981,7 @@ def test_stop_experiment( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" def test_stop_experiment_from_dict(): @@ -2006,6 +2024,7 @@ async def test_stop_experiment_async( display_name="display_name_value", description="description_value", state=experiment.Experiment.State.DRAFT, + rollout_failure_reason="rollout_failure_reason_value", ) ) response = await client.stop_experiment(request) @@ -2021,6 +2040,7 @@ async def test_stop_experiment_async( assert response.display_name == "display_name_value" assert response.description == "description_value" assert response.state == experiment.Experiment.State.DRAFT + assert response.rollout_failure_reason == "rollout_failure_reason_value" @pytest.mark.asyncio diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py index 735bf4e1..8b15db25 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py @@ -1614,11 +1614,39 @@ def test_parse_transition_route_group_path(): assert expected == actual -def test_webhook_path(): +def test_version_path(): project = "whelk" location = "octopus" agent = "oyster" - webhook = "nudibranch" + flow = "nudibranch" + version = "cuttlefish" + expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( + project=project, location=location, agent=agent, flow=flow, version=version, + ) + actual = SessionsClient.version_path(project, location, agent, flow, version) + assert expected == actual + + +def test_parse_version_path(): + expected = { + "project": "mussel", + "location": "winkle", + "agent": "nautilus", + "flow": "scallop", + "version": "abalone", + } + path = SessionsClient.version_path(**expected) + + # Check that the path construction is reversible. + actual = SessionsClient.parse_version_path(path) + assert expected == actual + + +def test_webhook_path(): + project = "squid" + location = "clam" + agent = "whelk" + webhook = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( project=project, location=location, agent=agent, webhook=webhook, ) @@ -1628,10 +1656,10 @@ def test_webhook_path(): def test_parse_webhook_path(): expected = { - "project": "cuttlefish", - "location": "mussel", - "agent": "winkle", - "webhook": "nautilus", + "project": "oyster", + "location": "nudibranch", + "agent": "cuttlefish", + "webhook": "mussel", } path = SessionsClient.webhook_path(**expected) @@ -1641,7 +1669,7 @@ def test_parse_webhook_path(): def test_common_billing_account_path(): - billing_account = "scallop" + billing_account = "winkle" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -1651,7 +1679,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "abalone", + "billing_account": "nautilus", } path = SessionsClient.common_billing_account_path(**expected) @@ -1661,7 +1689,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "squid" + folder = "scallop" expected = "folders/{folder}".format(folder=folder,) actual = SessionsClient.common_folder_path(folder) assert expected == actual @@ -1669,7 +1697,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "clam", + "folder": "abalone", } path = SessionsClient.common_folder_path(**expected) @@ -1679,7 +1707,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "whelk" + organization = "squid" expected = "organizations/{organization}".format(organization=organization,) actual = SessionsClient.common_organization_path(organization) assert expected == actual @@ -1687,7 +1715,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "octopus", + "organization": "clam", } path = SessionsClient.common_organization_path(**expected) @@ -1697,7 +1725,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "oyster" + project = "whelk" expected = "projects/{project}".format(project=project,) actual = SessionsClient.common_project_path(project) assert expected == actual @@ -1705,7 +1733,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "nudibranch", + "project": "octopus", } path = SessionsClient.common_project_path(**expected) @@ -1715,8 +1743,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "cuttlefish" - location = "mussel" + project = "oyster" + location = "nudibranch" expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -1726,8 +1754,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "winkle", - "location": "nautilus", + "project": "cuttlefish", + "location": "mussel", } path = SessionsClient.common_location_path(**expected)