Skip to main content

EXEC

Executes a provider resource method (built in procedure).

See also:
[ StackQL Resource Hierarchy ]


Syntax

execStatement::=

EXECqueryHintmultipartIdentifier'.'providerMethodNameparameterExpressionparameterExpression';'

 

EXEC [ queryHint ] <multipartIdentifier>.<methodName> [ <methodArguments> ];

Query Hints

Query hints supported for the EXEC command are summarised below:

HintDescription
/*+ SHOWRESULTS */Returns result set, designed for methods that return data, use SELECT however if possible.
/*+ AWAIT */Makes the operation blocking (synchronous), provides script control for long running operations (e.g. mutation operations).

Examples

Stopping a Google Compute Engine instance

Run an EXEC statement to stop a running Compute Engine instance in an authenticated session.

-- Stop a running Compute Engine resource instance
EXEC compute.instances.stop
@instance = 'demo-instance-1',
@project = 'stackql-demo',
@zone = 'australia-southeast1-a';

Starting a Google Compute Engine instance (synchronous option)

Run an EXEC statement to start a stopped Compute Engine instance in an authenticated session, uses the /*+ AWAIT */ query hint to make the operation blocking (synchronous).

-- Start a stopped Compute Engine resource instance
EXEC /*+ AWAIT */ compute.instances.stop
@instance = 'demo-instance-1',
@project = 'stackql-demo',
@zone = 'australia-southeast1-a';

Attach a Disk to a Google Compute Engine instance

Run an EXEC statement to attach a Disk to a Compute Engine instance in an authenticated session.

-- Attach a Disk resource to a Compute Engine instance
EXEC compute.instances.attachDisk
@zone='australia-southeast1-a',
@project='stackql-demo',
@instance='demo-instance-1'
@@json=
'{
"source": "projects/stackql-demo/zones/australia-southeast1-a/disks/test10gbdisk2",
"boot": false
}';

Simulate Azure Spot VM eviction

Run an EXEC statement to simulate eviction of Azure Spot VM Instance.

exec azure.compute.virtual_machine.simulate_eviction
@subscriptionId = '0123456789',
@resourceGroupName = 'vmss-flex',
@vmName = 'vmss-flex-manual-1';