REPLACE
Updates all fields in a resource (synonymous with a put
operation).
See also:
[ StackQL Resource Hierarchy ] [ UPDATE
]
Syntax
replaceStatement::=
REPLACE [ /*+ AWAIT */ ] <multipartIdentifier>
SET field_name = value [, field_name = value ...]
[ WHERE condition ];
Examples
Basic REPLACE
statement
Run an REPLACE
statement to modify a Compute Engine Disk resource's size.
-- Update the size of a Compute Engine Disk resource
REPLACE google.compute.disks
SET sizeGb = 20
WHERE project = 'stackql-demo'
AND zone = 'australia-southeast1-a'
AND name = 'test10gbdisk';
REPLACE
statement (blocking)
Run an REPLACE
statement to modify a Compute Engine Disk resource's size. This is a blocking (synchronous) invocation.
-- Synchronous update of a google firewall
REPLACE /*+ AWAIT */ google.compute.firewalls
SET
data__network = 'https://www.googleapis.com/compute/v1/projects/stackql-demo/global/networks/my-vpc',
data__direction = 'INGRESS',
data__sourceRanges = '["0.0.0.0/0"]',
data__allowed = '[{"IPProtocol": "tcp", "ports": ["22"]}, {"IPProtocol": "tcp", "ports": ["6443"]},{"IPProtocol": "icmp"}]'
WHERE firewall = 'test-fw'
AND project = 'stackql-demo'
REPLACE
statement with JSON modification
Run an REPLACE
statement to modify a resource using JSON manipulation.
-- Update an Azure Network Interface's properties
REPLACE azure.network.interfaces
SET data__properties = json_replace(
json_remove(data__properties,
'$.auxiliarySku',
'$.provisioningState',
'$.resourceGuid',
'$.macAddress'
),
'$.ipConfigurations[0].name',
'newIpConfigurationName'
)
WHERE subscriptionId = '0123456789'
AND resourceGroupName = 'vmss-flex'
AND networkInterfaceName = 'vmss-nic-01';