翻訳ページ
このページは AI の支援を受けて英語から翻訳されています。内容が異なる場合は英語版が正となります。
REPLACE
リソースのすべてのフィールドを更新します(put 操作と同義)。
関連項目:
[ StackQL リソース階層 ] [ UPDATE ]
構文
replaceStatement::=
REPLACE [ /*+ AWAIT */ ] <multipartIdentifier>
SET field_name = value [, field_name = value ...]
[ WHERE condition ];
例
基本的な REPLACE 文
Compute Engine のディスクリソースのサイズを変更する REPLACE 文を実行します。
-- 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 文(ブロッキング)
Compute Engine のディスクリソースのサイズを変更する REPLACE 文を実行します。これはブロッキング(同期)呼び出しです。
-- 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'
JSON の変更を伴う REPLACE 文
JSON 操作でリソースを変更する REPLACE 文を実行します。
-- Update an Azure Network Interface's properties
REPLACE azure.network.network_interfaces
SET data__properties = json_replace(
json_remove(data__properties,
'$.auxiliarySku',
'$.provisioningState',
'$.resourceGuid',
'$.macAddress'
),
'$.ipConfigurations[0].name',
'newIpConfigurationName'
)
WHERE subscription_id = '0123456789'
AND resource_group_name = 'vmss-flex'
AND network_interface_name = 'vmss-nic-01';