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

Commit 1844193

Browse files
feat(v3): add support for locking an agent for changes (#276)
- [ ] Regenerate this pull request now. feat: added data format specification for export agent PiperOrigin-RevId: 437338899 Source-Link: googleapis/googleapis@94287f4 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c0bb2ea072245b0731a9f208ae64082de073f238 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzBiYjJlYTA3MjI0NWIwNzMxYTlmMjA4YWU2NDA4MmRlMDczZjIzOCJ9
1 parent 560e6a4 commit 1844193

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

dialogflow-cx-v3-py.tar.gz

-416 KB
Binary file not shown.

google/cloud/dialogflowcx_v3/types/agent.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ class Agent(proto.Message):
125125
enable_spell_correction (bool):
126126
Indicates if automatic spell correction is
127127
enabled in detect intent requests.
128+
locked (bool):
129+
Indiciates whether the agent is locked for changes. If the
130+
agent is locked, modifications to the agent will be rejected
131+
except for [RestoreAgent][].
128132
advanced_settings (google.cloud.dialogflowcx_v3.types.AdvancedSettings):
129133
Hierarchical advanced settings for this
130134
agent. The settings exposed at the lower level
@@ -146,6 +150,7 @@ class Agent(proto.Message):
146150
security_settings = proto.Field(proto.STRING, number=17,)
147151
enable_stackdriver_logging = proto.Field(proto.BOOL, number=18,)
148152
enable_spell_correction = proto.Field(proto.BOOL, number=20,)
153+
locked = proto.Field(proto.BOOL, number=27,)
149154
advanced_settings = proto.Field(
150155
proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings,
151156
)
@@ -275,14 +280,23 @@ class ExportAgentRequest(proto.Message):
275280
authentication must have write permissions for the object.
276281
For more information, see `Dialogflow access
277282
control <https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage>`__.
283+
data_format (google.cloud.dialogflowcx_v3.types.ExportAgentRequest.DataFormat):
284+
Optional. The data format of the exported agent. If not
285+
specified, ``BLOB`` is assumed.
278286
environment (str):
279287
Optional. Environment name. If not set, draft environment is
280288
assumed. Format:
281289
``projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/environments/<Environment ID>``.
282290
"""
283291

292+
class DataFormat(proto.Enum):
293+
r"""Data format of the exported agent."""
294+
DATA_FORMAT_UNSPECIFIED = 0
295+
BLOB = 1
296+
284297
name = proto.Field(proto.STRING, number=1,)
285298
agent_uri = proto.Field(proto.STRING, number=2,)
299+
data_format = proto.Field(proto.ENUM, number=3, enum=DataFormat,)
286300
environment = proto.Field(proto.STRING, number=5,)
287301

288302

scripts/fixup_dialogflowcx_v3_keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class dialogflowcxCallTransformer(cst.CSTTransformer):
7070
'delete_webhook': ('name', 'force', ),
7171
'deploy_flow': ('environment', 'flow_version', ),
7272
'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', ),
73-
'export_agent': ('name', 'agent_uri', 'environment', ),
73+
'export_agent': ('name', 'agent_uri', 'data_format', 'environment', ),
7474
'export_flow': ('name', 'flow_uri', 'include_referenced_flows', ),
7575
'export_test_cases': ('parent', 'gcs_uri', 'data_format', 'filter', ),
7676
'fulfill_intent': ('match_intent_request', 'match', 'output_audio_config', ),

tests/unit/gapic/dialogflowcx_v3/test_agents.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ def test_get_agent(request_type, transport: str = "grpc"):
928928
security_settings="security_settings_value",
929929
enable_stackdriver_logging=True,
930930
enable_spell_correction=True,
931+
locked=True,
931932
)
932933
response = client.get_agent(request)
933934

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

953955

954956
def test_get_agent_empty_call():
@@ -994,6 +996,7 @@ async def test_get_agent_async(
994996
security_settings="security_settings_value",
995997
enable_stackdriver_logging=True,
996998
enable_spell_correction=True,
999+
locked=True,
9971000
)
9981001
)
9991002
response = await client.get_agent(request)
@@ -1016,6 +1019,7 @@ async def test_get_agent_async(
10161019
assert response.security_settings == "security_settings_value"
10171020
assert response.enable_stackdriver_logging is True
10181021
assert response.enable_spell_correction is True
1022+
assert response.locked is True
10191023

10201024

10211025
@pytest.mark.asyncio
@@ -1163,6 +1167,7 @@ def test_create_agent(request_type, transport: str = "grpc"):
11631167
security_settings="security_settings_value",
11641168
enable_stackdriver_logging=True,
11651169
enable_spell_correction=True,
1170+
locked=True,
11661171
)
11671172
response = client.create_agent(request)
11681173

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

11881194

11891195
def test_create_agent_empty_call():
@@ -1229,6 +1235,7 @@ async def test_create_agent_async(
12291235
security_settings="security_settings_value",
12301236
enable_stackdriver_logging=True,
12311237
enable_spell_correction=True,
1238+
locked=True,
12321239
)
12331240
)
12341241
response = await client.create_agent(request)
@@ -1251,6 +1258,7 @@ async def test_create_agent_async(
12511258
assert response.security_settings == "security_settings_value"
12521259
assert response.enable_stackdriver_logging is True
12531260
assert response.enable_spell_correction is True
1261+
assert response.locked is True
12541262

12551263

12561264
@pytest.mark.asyncio
@@ -1412,6 +1420,7 @@ def test_update_agent(request_type, transport: str = "grpc"):
14121420
security_settings="security_settings_value",
14131421
enable_stackdriver_logging=True,
14141422
enable_spell_correction=True,
1423+
locked=True,
14151424
)
14161425
response = client.update_agent(request)
14171426

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

14371447

14381448
def test_update_agent_empty_call():
@@ -1478,6 +1488,7 @@ async def test_update_agent_async(
14781488
security_settings="security_settings_value",
14791489
enable_stackdriver_logging=True,
14801490
enable_spell_correction=True,
1491+
locked=True,
14811492
)
14821493
)
14831494
response = await client.update_agent(request)
@@ -1500,6 +1511,7 @@ async def test_update_agent_async(
15001511
assert response.security_settings == "security_settings_value"
15011512
assert response.enable_stackdriver_logging is True
15021513
assert response.enable_spell_correction is True
1514+
assert response.locked is True
15031515

15041516

15051517
@pytest.mark.asyncio

0 commit comments

Comments
 (0)