Skip to content

Commit 5324195

Browse files
feat: [google-cloud-modelarmor] MultiLanguage Detection in Model Armor Floor Setting (googleapis#14138)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: MultiLanguage Detection in Model Armor Floor Setting feat: Add support for EnforcementType docs: fix comment formatting END_COMMIT_OVERRIDE PiperOrigin-RevId: 786202489 Source-Link: googleapis/googleapis@2af1541 Source-Link: https://github.com/googleapis/googleapis-gen/commit/71ae323a587fd1a81daf51c5b6575bfca4212eb7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1vZGVsYXJtb3IvLk93bEJvdC55YW1sIiwiaCI6IjcxYWUzMjNhNTg3ZmQxYTgxZGFmNTFjNWI2NTc1YmZjYTQyMTJlYjcifQ== BEGIN_NESTED_COMMIT feat: [google-cloud-modelarmor] MultiLanguage Detection in Model Armor Floor Setting feat: Add support for EnforcementType docs: fix comment formatting PiperOrigin-RevId: 786201115 Source-Link: googleapis/googleapis@01f50f9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/3e02918057d866278925eb4ffecd59ba5384f875 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1vZGVsYXJtb3IvLk93bEJvdC55YW1sIiwiaCI6IjNlMDI5MTgwNTdkODY2Mjc4OTI1ZWI0ZmZlY2Q1OWJhNTM4NGY4NzUifQ== END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 6c02b3b commit 5324195

File tree

14 files changed

+323
-5
lines changed

14 files changed

+323
-5
lines changed

packages/google-cloud-modelarmor/google/cloud/modelarmor/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
)
2424
from google.cloud.modelarmor_v1.services.model_armor.client import ModelArmorClient
2525
from google.cloud.modelarmor_v1.types.service import (
26+
AiPlatformFloorSetting,
2627
ByteDataItem,
2728
CreateTemplateRequest,
2829
CsamFilterResult,
@@ -72,6 +73,7 @@
7273
__all__ = (
7374
"ModelArmorClient",
7475
"ModelArmorAsyncClient",
76+
"AiPlatformFloorSetting",
7577
"ByteDataItem",
7678
"CreateTemplateRequest",
7779
"CsamFilterResult",

packages/google-cloud-modelarmor/google/cloud/modelarmor/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.2.6" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from .services.model_armor import ModelArmorAsyncClient, ModelArmorClient
2222
from .types.service import (
23+
AiPlatformFloorSetting,
2324
ByteDataItem,
2425
CreateTemplateRequest,
2526
CsamFilterResult,
@@ -68,6 +69,7 @@
6869

6970
__all__ = (
7071
"ModelArmorAsyncClient",
72+
"AiPlatformFloorSetting",
7173
"ByteDataItem",
7274
"CreateTemplateRequest",
7375
"CsamFilterResult",

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.2.6" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616
from .service import (
17+
AiPlatformFloorSetting,
1718
ByteDataItem,
1819
CreateTemplateRequest,
1920
CsamFilterResult,
@@ -61,6 +62,7 @@
6162
)
6263

6364
__all__ = (
65+
"AiPlatformFloorSetting",
6466
"ByteDataItem",
6567
"CreateTemplateRequest",
6668
"CsamFilterResult",

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1/types/service.py

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"InvocationResult",
3333
"Template",
3434
"FloorSetting",
35+
"AiPlatformFloorSetting",
3536
"ListTemplatesRequest",
3637
"ListTemplatesResponse",
3738
"GetTemplateRequest",
@@ -246,11 +247,32 @@ class TemplateMetadata(proto.Message):
246247
operations.
247248
log_sanitize_operations (bool):
248249
Optional. If true, log sanitize operations.
250+
enforcement_type (google.cloud.modelarmor_v1.types.Template.TemplateMetadata.EnforcementType):
251+
Optional. Enforcement type for Model Armor
252+
filters.
249253
multi_language_detection (google.cloud.modelarmor_v1.types.Template.TemplateMetadata.MultiLanguageDetection):
250254
Optional. Metadata for multi language
251255
detection.
252256
"""
253257

258+
class EnforcementType(proto.Enum):
259+
r"""Enforcement type for Model Armor filters.
260+
261+
Values:
262+
ENFORCEMENT_TYPE_UNSPECIFIED (0):
263+
Default value. Same as INSPECT_AND_BLOCK.
264+
INSPECT_ONLY (1):
265+
Model Armor filters will run in inspect only
266+
mode. No action will be taken on the request.
267+
INSPECT_AND_BLOCK (2):
268+
Model Armor filters will run in inspect and
269+
block mode. Requests that trip Model Armor
270+
filters will be blocked.
271+
"""
272+
ENFORCEMENT_TYPE_UNSPECIFIED = 0
273+
INSPECT_ONLY = 1
274+
INSPECT_AND_BLOCK = 2
275+
254276
class MultiLanguageDetection(proto.Message):
255277
r"""Metadata to enable multi language detection via template.
256278
@@ -293,6 +315,11 @@ class MultiLanguageDetection(proto.Message):
293315
proto.BOOL,
294316
number=7,
295317
)
318+
enforcement_type: "Template.TemplateMetadata.EnforcementType" = proto.Field(
319+
proto.ENUM,
320+
number=8,
321+
enum="Template.TemplateMetadata.EnforcementType",
322+
)
296323
multi_language_detection: "Template.TemplateMetadata.MultiLanguageDetection" = (
297324
proto.Field(
298325
proto.MESSAGE,
@@ -350,8 +377,32 @@ class FloorSetting(proto.Message):
350377
Optional. Floor Settings enforcement status.
351378
352379
This field is a member of `oneof`_ ``_enable_floor_setting_enforcement``.
380+
integrated_services (MutableSequence[google.cloud.modelarmor_v1.types.FloorSetting.IntegratedService]):
381+
Optional. List of integrated services for
382+
which the floor setting is applicable.
383+
ai_platform_floor_setting (google.cloud.modelarmor_v1.types.AiPlatformFloorSetting):
384+
Optional. AI Platform floor setting.
385+
386+
This field is a member of `oneof`_ ``_ai_platform_floor_setting``.
387+
floor_setting_metadata (google.cloud.modelarmor_v1.types.FloorSetting.FloorSettingMetadata):
388+
Optional. Metadata for FloorSetting
353389
"""
354390

391+
class IntegratedService(proto.Enum):
392+
r"""Integrated service for which the floor setting is applicable.
393+
394+
Values:
395+
INTEGRATED_SERVICE_UNSPECIFIED (0):
396+
Unspecified integrated service.
397+
AI_PLATFORM (1):
398+
AI Platform.
399+
"""
400+
INTEGRATED_SERVICE_UNSPECIFIED = 0
401+
AI_PLATFORM = 1
402+
403+
class FloorSettingMetadata(proto.Message):
404+
r"""message describing FloorSetting Metadata"""
405+
355406
name: str = proto.Field(
356407
proto.STRING,
357408
number=1,
@@ -376,6 +427,66 @@ class FloorSetting(proto.Message):
376427
number=5,
377428
optional=True,
378429
)
430+
integrated_services: MutableSequence[IntegratedService] = proto.RepeatedField(
431+
proto.ENUM,
432+
number=6,
433+
enum=IntegratedService,
434+
)
435+
ai_platform_floor_setting: "AiPlatformFloorSetting" = proto.Field(
436+
proto.MESSAGE,
437+
number=7,
438+
optional=True,
439+
message="AiPlatformFloorSetting",
440+
)
441+
floor_setting_metadata: FloorSettingMetadata = proto.Field(
442+
proto.MESSAGE,
443+
number=8,
444+
message=FloorSettingMetadata,
445+
)
446+
447+
448+
class AiPlatformFloorSetting(proto.Message):
449+
r"""message describing AiPlatformFloorSetting
450+
451+
This message has `oneof`_ fields (mutually exclusive fields).
452+
For each oneof, at most one member field can be set at the same time.
453+
Setting any member of the oneof automatically clears all other
454+
members.
455+
456+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
457+
458+
Attributes:
459+
inspect_only (bool):
460+
Optional. If true, Model Armor filters will
461+
be run in inspect only mode. No action will be
462+
taken on the request.
463+
464+
This field is a member of `oneof`_ ``enforcement_type``.
465+
inspect_and_block (bool):
466+
Optional. If true, Model Armor filters will
467+
be run in inspect and block mode. Requests that
468+
trip Model Armor filters will be blocked.
469+
470+
This field is a member of `oneof`_ ``enforcement_type``.
471+
enable_cloud_logging (bool):
472+
Optional. If true, log Model Armor filter
473+
results to Cloud Logging.
474+
"""
475+
476+
inspect_only: bool = proto.Field(
477+
proto.BOOL,
478+
number=1,
479+
oneof="enforcement_type",
480+
)
481+
inspect_and_block: bool = proto.Field(
482+
proto.BOOL,
483+
number=2,
484+
oneof="enforcement_type",
485+
)
486+
enable_cloud_logging: bool = proto.Field(
487+
proto.BOOL,
488+
number=3,
489+
)
379490

380491

381492
class ListTemplatesRequest(proto.Message):

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1beta/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from .services.model_armor import ModelArmorAsyncClient, ModelArmorClient
2222
from .types.service import (
23+
AiPlatformFloorSetting,
2324
ByteDataItem,
2425
CreateTemplateRequest,
2526
CsamFilterResult,
@@ -68,6 +69,7 @@
6869

6970
__all__ = (
7071
"ModelArmorAsyncClient",
72+
"AiPlatformFloorSetting",
7173
"ByteDataItem",
7274
"CreateTemplateRequest",
7375
"CsamFilterResult",

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1beta/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.2.6" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-modelarmor/google/cloud/modelarmor_v1beta/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# limitations under the License.
1515
#
1616
from .service import (
17+
AiPlatformFloorSetting,
1718
ByteDataItem,
1819
CreateTemplateRequest,
1920
CsamFilterResult,
@@ -61,6 +62,7 @@
6162
)
6263

6364
__all__ = (
65+
"AiPlatformFloorSetting",
6466
"ByteDataItem",
6567
"CreateTemplateRequest",
6668
"CsamFilterResult",

0 commit comments

Comments
 (0)