Container Registry API, gRPC: ScanPolicyService.Create
Creates a scan policy for the specified registry.
gRPC request
rpc Create (CreateScanPolicyRequest) returns (operation.Operation)
CreateScanPolicyRequest
{
"registry_id": "string",
"name": "string",
"description": "string",
"rules": {
"push_rule": {
"repository_prefixes": [
"string"
],
"disabled": "bool"
},
"schedule_rules": [
{
"repository_prefixes": [
"string"
],
"rescan_period": "google.protobuf.Duration",
"disabled": "bool"
}
]
}
}
Field |
Description |
registry_id |
string Required field. ID of the scan policy registry. |
name |
string Name of the scan policy. |
description |
string Description of the scan policy. |
rules |
Rules of the scan policy. |
ScanRules
Field |
Description |
push_rule |
Description of on-push scan rule. |
schedule_rules[] |
Description of time based rescan rule. |
PushRule
Field |
Description |
repository_prefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
disabled |
bool Turns off scan rule. |
ScheduledRule
Field |
Description |
repository_prefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
rescan_period |
Required field. Period of time since last scan to trigger automatic rescan. |
disabled |
bool Turns off scan rule. |
operation.Operation
{
"id": "string",
"description": "string",
"created_at": "google.protobuf.Timestamp",
"created_by": "string",
"modified_at": "google.protobuf.Timestamp",
"done": "bool",
"metadata": {
"scan_policy_id": "string"
},
// Includes only one of the fields `error`, `response`
"error": "google.rpc.Status",
"response": {
"id": "string",
"registry_id": "string",
"name": "string",
"description": "string",
"rules": {
"push_rule": {
"repository_prefixes": [
"string"
],
"disabled": "bool"
},
"schedule_rules": [
{
"repository_prefixes": [
"string"
],
"rescan_period": "google.protobuf.Duration",
"disabled": "bool"
}
]
},
"created_at": "google.protobuf.Timestamp",
"disabled": "bool"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
created_at |
Creation timestamp. |
created_by |
string ID of the user or service account who initiated the operation. |
modified_at |
The time when the Operation resource was last modified. |
done |
bool If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
CreateScanPolicyMetadata
Field |
Description |
scan_policy_id |
string ID of created scan policy resource. |
ScanPolicy
Field |
Description |
id |
string Output only. ID of the scan policy. |
registry_id |
string ID of the registry that the scan policy belongs to. |
name |
string Name of the scan policy. |
description |
string Description of the scan policy. |
rules |
The rules of scan policy. |
created_at |
Output only. Creation timestamp. |
disabled |
bool Turns off scan policy. |
ScanRules
Field |
Description |
push_rule |
Description of on-push scan rule. |
schedule_rules[] |
Description of time based rescan rule. |
PushRule
Field |
Description |
repository_prefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
disabled |
bool Turns off scan rule. |
ScheduledRule
Field |
Description |
repository_prefixes[] |
string List of repositories that are scanned with rule. Child repositories are included into parent node. "*" - means all repositories in registry |
rescan_period |
Required field. Period of time since last scan to trigger automatic rescan. |
disabled |
bool Turns off scan rule. |