rules
Creates, updates, deletes, gets or lists a rules
resource.
Overview
Name | rules |
Type | Resource |
Id | google.artifactregistry.rules |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The name of the rule, for example: projects/p1/locations/us-central1/repositories/repo1/rules/rule1 . |
action | string | The action this rule takes. |
condition | object | Optional. A CEL expression for conditions that must be met in order for the rule to apply. If not provided, the rule matches all objects. (id: Expr) |
operation | string | |
packageId | string | The package ID the rule applies to. If empty, this rule applies to all packages inside the repository. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The name of the rule, for example: projects/p1/locations/us-central1/repositories/repo1/rules/rule1 . |
action | string | The action this rule takes. |
condition | object | Optional. A CEL expression for conditions that must be met in order for the rule to apply. If not provided, the rule matches all objects. (id: Expr) |
operation | string | |
packageId | string | The package ID the rule applies to. If empty, this rule applies to all packages inside the repository. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , repositoriesId , rulesId | Gets a rule. | |
list | select | projectsId , locationsId , repositoriesId | pageSize , pageToken | Lists rules. |
create | insert | projectsId , locationsId , repositoriesId | ruleId | Creates a rule. |
patch | update | projectsId , locationsId , repositoriesId , rulesId | updateMask | Updates a rule. |
delete | delete | projectsId , locationsId , repositoriesId , rulesId | Deletes a rule. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
locationsId | string | |
projectsId | string | |
repositoriesId | string | |
rulesId | string | |
pageSize | integer (int32) | |
pageToken | string | |
ruleId | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Gets a rule.
SELECT
name,
action,
condition,
operation,
packageId
FROM google.artifactregistry.rules
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND rulesId = '{{ rulesId }}' -- required;
Lists rules.
SELECT
name,
action,
condition,
operation,
packageId
FROM google.artifactregistry.rules
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND repositoriesId = '{{ repositoriesId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Creates a rule.
INSERT INTO google.artifactregistry.rules (
data__name,
data__action,
data__operation,
data__condition,
data__packageId,
projectsId,
locationsId,
repositoriesId,
ruleId
)
SELECT
'{{ name }}',
'{{ action }}',
'{{ operation }}',
'{{ condition }}',
'{{ packageId }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ repositoriesId }}',
'{{ ruleId }}'
RETURNING
name,
action,
condition,
operation,
packageId
;
# Description fields are for documentation purposes
- name: rules
props:
- name: projectsId
value: string
description: Required parameter for the rules resource.
- name: locationsId
value: string
description: Required parameter for the rules resource.
- name: repositoriesId
value: string
description: Required parameter for the rules resource.
- name: name
value: string
description: >
The name of the rule, for example: `projects/p1/locations/us-central1/repositories/repo1/rules/rule1`.
- name: action
value: string
description: >
The action this rule takes.
valid_values: ['ACTION_UNSPECIFIED', 'ALLOW', 'DENY']
- name: operation
value: string
valid_values: ['OPERATION_UNSPECIFIED', 'DOWNLOAD']
- name: condition
value: object
description: >
Optional. A CEL expression for conditions that must be met in order for the rule to apply. If not provided, the rule matches all objects.
- name: packageId
value: string
description: >
The package ID the rule applies to. If empty, this rule applies to all packages inside the repository.
- name: ruleId
value: string
UPDATE
examples
- patch
Updates a rule.
UPDATE google.artifactregistry.rules
SET
data__name = '{{ name }}',
data__action = '{{ action }}',
data__operation = '{{ operation }}',
data__condition = '{{ condition }}',
data__packageId = '{{ packageId }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND rulesId = '{{ rulesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
action,
condition,
operation,
packageId;
DELETE
examples
- delete
Deletes a rule.
DELETE FROM google.artifactregistry.rules
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND repositoriesId = '{{ repositoriesId }}' --required
AND rulesId = '{{ rulesId }}' --required;