Skip to main content

SHOW

Used to list items in a collection, for instance show all of the services available in a provider, or show all of the resources available in a given service.

See also:
[ StackQL Resource Hierarchy ]


Syntax

showStatement::=

SHOWEXTENDEDSERVICESRESOURCESMETHODSFROMINmultipartIdentifierLIKEpatternWHEREexpressionPROVIDERSAUTHINSERTINTOmultipartIdentifier';'

 

SHOW [ EXTENDED ]
{ PROVIDERS | SERVICES | RESOURCES | METHODS | AUTH | INSERT INTO <resource> }
[ { IN | FROM } { <provider> | <service> | <resource> } ]
[ { LIKE <pattern> | WHERE <expression> } ];

Examples

List all providers

List all of the available cloud providers in the installed version of StackQL.

-- Returns all of the available cloud providers
SHOW PROVIDERS;

Returns :

+------------+
| NAME |
+------------+
| google |
| aws |
| azure |
| kubernetes |
+------------+

List all services in a cloud provider

List all of the services available within a given cloud provider, use the optional EXTENDED keyword to return additional information.

-- Returns all services available in a cloud provider
SHOW EXTENDED SERVICES IN google;

Returns :

+---------------+-----------+------------------------+---------+----------------------------------------------------------------------------------------------------+
| ID | NAME | TITLE | VERSION | DESCRIPTION |
+---------------+-----------+------------------------+---------+----------------------------------------------------------------------------------------------------+
| compute__v1 | compute | Compute Engine API | v1 | Creates and runs virtual machines on Google Cloud Platform. |
| storage__v1 | storage | Cloud Storage JSON API | v1 | Stores and retrieves potentially large, immutable data objects. |
| container__v1 | container | Kubernetes Engine API | v1 | Builds and manages container-based applications, powered by the open source Kubernetes technology. |
| bigquery__v2 | bigquery | BigQuery API | v2 | A data platform for customers to create, manage, share and query data. |
| ... | ... | ... | ... | ... |
+---------------+-----------+------------------------+---------+----------------------------------------------------------------------------------------------------+

List all resources within a cloud provider service

List all of the resources available within a given service of a cloud provider. The USE statement can be used to specify a cloud provider for an StackQL session. The optional EXTENDED keyword returns the resource description in addition to the resource name.

-- Returns all resources available in a cloud provider service
USE google;
SHOW EXTENDED RESOURCES IN compute;

Returns :

+-----------+------------------------------------------------------------------------------------------------------------+
| NAME | DESCRIPTION |
+-----------+------------------------------------------------------------------------------------------------------------+
| instances | Represents an Instance resource. An instance is a virtual machine that is hosted on Google Cloud Platform. |
| networks | Represents a VPC Network resource. Networks connect resources to each other and to the internet. |
| images | Represents an Image resource. You can use images to create boot disks for your VM instances. |
| ... | ... |
+-----------+------------------------------------------------------------------------------------------------------------+

Show available methods for a resource within a cloud provider service

List all of the methods available for a given resource.

-- Returns all methods available for a cloud provider resource
USE google;
SHOW METHODS IN compute.instances;

Returns :

|------------------------------------|--------------------------------|
| MethodName | RequiredParams |
|------------------------------------|--------------------------------|
| start | zone, instance, project |
|------------------------------------|--------------------------------|
| setServiceAccount | instance, project, zone |
|------------------------------------|--------------------------------|
| setDiskAutoDelete | project, zone, autoDelete, |
| | deviceName, instance |
|------------------------------------|--------------------------------|
| getScreenshot | instance, project, zone |
|------------------------------------|--------------------------------|
| updateNetworkInterface | instance, networkInterface, |
| | project, zone |
|------------------------------------|--------------------------------|
| testIamPermissions | project, resource, zone |
|------------------------------------|--------------------------------|
| stop | instance, project, zone |
|------------------------------------|--------------------------------|
..
|------------------------------------|--------------------------------|

Generating an INSERT template using the SHOW INSERT command

The SHOW command can be used to generate templates for INSERT statements as shown here:

SHOW INSERT INTO google.compute.addresses;

Returns :

INSERT INTO google.compute.addresses(
project,
region,
data__address,
data__addressType,
data__description,
data__ipVersion,
data__name,
data__network,
data__networkTier,
data__prefixLength,
data__purpose,
data__subnetwork
)
SELECT
'{{ .values.project }}',
'{{ .values.region }}',
'{{ .values.data__address }}',
'{{ .values.data__addressType }}',
'{{ .values.data__description }}',
'{{ .values.data__ipVersion }}',
'{{ .values.data__name }}',
'{{ .values.data__network }}',
'{{ .values.data__networkTier }}',
{{ .values.data__prefixLength }},
'{{ .values.data__purpose }}',
'{{ .values.data__subnetwork }}'

The fields returned can be limited to only those required by the provider, see Creating Infrastructure Templates for examples of this.

This template can then be used along with a json or jsonnet data file to supply values at run time,for more information see Using Variables.