Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
feat(v3): add support for locking an agent for changes (#276)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

feat: added data format specification for export agent

PiperOrigin-RevId: 437338899

Source-Link: googleapis/googleapis@94287f4

Source-Link: googleapis/googleapis-gen@c0bb2ea
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzBiYjJlYTA3MjI0NWIwNzMxYTlmMjA4YWU2NDA4MmRlMDczZjIzOCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Mar 27, 2022
1 parent 560e6a4 commit 1844193
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
Binary file modified dialogflow-cx-v3-py.tar.gz
Binary file not shown.
14 changes: 14 additions & 0 deletions google/cloud/dialogflowcx_v3/types/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class Agent(proto.Message):
enable_spell_correction (bool):
Indicates if automatic spell correction is
enabled in detect intent requests.
locked (bool):
Indiciates whether the agent is locked for changes. If the
agent is locked, modifications to the agent will be rejected
except for [RestoreAgent][].
advanced_settings (google.cloud.dialogflowcx_v3.types.AdvancedSettings):
Hierarchical advanced settings for this
agent. The settings exposed at the lower level
Expand All @@ -146,6 +150,7 @@ 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,)
locked = proto.Field(proto.BOOL, number=27,)
advanced_settings = proto.Field(
proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings,
)
Expand Down Expand Up @@ -275,14 +280,23 @@ class ExportAgentRequest(proto.Message):
authentication must have write permissions for the object.
For more information, see `Dialogflow access
control <https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage>`__.
data_format (google.cloud.dialogflowcx_v3.types.ExportAgentRequest.DataFormat):
Optional. The data format of the exported agent. If not
specified, ``BLOB`` is assumed.
environment (str):
Optional. Environment name. If not set, draft environment is
assumed. Format:
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>``.
"""

class DataFormat(proto.Enum):
r"""Data format of the exported agent."""
DATA_FORMAT_UNSPECIFIED = 0
BLOB = 1

name = proto.Field(proto.STRING, number=1,)
agent_uri = proto.Field(proto.STRING, number=2,)
data_format = proto.Field(proto.ENUM, number=3, enum=DataFormat,)
environment = proto.Field(proto.STRING, number=5,)


Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_dialogflowcx_v3_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class dialogflowcxCallTransformer(cst.CSTTransformer):
'delete_webhook': ('name', 'force', ),
'deploy_flow': ('environment', 'flow_version', ),
'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', ),
'export_agent': ('name', 'agent_uri', 'environment', ),
'export_agent': ('name', 'agent_uri', 'data_format', 'environment', ),
'export_flow': ('name', 'flow_uri', 'include_referenced_flows', ),
'export_test_cases': ('parent', 'gcs_uri', 'data_format', 'filter', ),
'fulfill_intent': ('match_intent_request', 'match', 'output_audio_config', ),
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/gapic/dialogflowcx_v3/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,7 @@ def test_get_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.get_agent(request)

Expand All @@ -949,6 +950,7 @@ def test_get_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_get_agent_empty_call():
Expand Down Expand Up @@ -994,6 +996,7 @@ async def test_get_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.get_agent(request)
Expand All @@ -1016,6 +1019,7 @@ async def test_get_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down Expand Up @@ -1163,6 +1167,7 @@ def test_create_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.create_agent(request)

Expand All @@ -1184,6 +1189,7 @@ def test_create_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_create_agent_empty_call():
Expand Down Expand Up @@ -1229,6 +1235,7 @@ async def test_create_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.create_agent(request)
Expand All @@ -1251,6 +1258,7 @@ async def test_create_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down Expand Up @@ -1412,6 +1420,7 @@ def test_update_agent(request_type, transport: str = "grpc"):
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
response = client.update_agent(request)

Expand All @@ -1433,6 +1442,7 @@ def test_update_agent(request_type, transport: str = "grpc"):
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


def test_update_agent_empty_call():
Expand Down Expand Up @@ -1478,6 +1488,7 @@ async def test_update_agent_async(
security_settings="security_settings_value",
enable_stackdriver_logging=True,
enable_spell_correction=True,
locked=True,
)
)
response = await client.update_agent(request)
Expand All @@ -1500,6 +1511,7 @@ async def test_update_agent_async(
assert response.security_settings == "security_settings_value"
assert response.enable_stackdriver_logging is True
assert response.enable_spell_correction is True
assert response.locked is True


@pytest.mark.asyncio
Expand Down

0 comments on commit 1844193

Please sign in to comment.