Skip to content

Service Requests

Service requests tell the SDK what to discover. Each request specifies a cloud service, provider, region, and which attributes to return.

Defining requests

Push requests onto the serviceDiscoveryRequests array before the SDK scripts load:

<script>
    var serviceDiscoveryRequests = serviceDiscoveryRequests || [];

    serviceDiscoveryRequests.push({
        service: 'ec2',
        provider: 'aws',
        region: 'eu-west-2',
        source: 'live',
        attributes: ['name', 'instance_id', 'instance_type', 'state', 'private_ip']
    });

    serviceDiscoveryRequests.push({
        service: 's3',
        provider: 'aws',
        region: 'eu-west-2',
        source: 'live',
        attributes: ['bucket_name', 'creation_date', 'region', 'versioning_status']
    });
</script>

Request fields

Field Type Required Description
service string Yes Service identifier (e.g., ec2, s3, lambda_functions, gcp_compute_instances). See the Service Catalogue.
provider string Yes Cloud provider: aws, gcp, or azure.
region string Yes Cloud region (e.g., eu-west-2, us-east-1, europe-west2).
source string No live (default) fetches from the cloud API. mock uses local mock data for development.
attributes array No List of attribute names to include as table columns. If omitted, all available attributes are returned.
account string No Account alias (for account groups). Routes the request to a specific cloud account within the group.

Selecting attributes

Each service has a set of available attributes. Specify only the ones you need to keep tables focused:

// Show only name and state
serviceDiscoveryRequests.push({
    service: 'ec2',
    provider: 'aws',
    region: 'eu-west-2',
    attributes: ['name', 'state']
});

Omit attributes to return all available fields for the service:

// All attributes
serviceDiscoveryRequests.push({
    service: 'ec2',
    provider: 'aws',
    region: 'eu-west-2'
});

For the full list of attributes per service, see AWS Services, GCP Services, or Azure Services.

Multiple requests

You can push any number of requests. The SDK batches them into a single API call:

<script>
    var serviceDiscoveryRequests = serviceDiscoveryRequests || [];

    serviceDiscoveryRequests.push(
        { service: 'ec2', provider: 'aws', region: 'eu-west-2', source: 'live' },
        { service: 's3', provider: 'aws', region: 'eu-west-2', source: 'live' },
        { service: 'lambda_functions', provider: 'aws', region: 'eu-west-2', source: 'live' },
        { service: 'gcp_compute_instances', provider: 'gcp', region: 'europe-west2', source: 'live' }
    );
</script>

Batch size limits

Access keys may have a max_batch_size constraint. If your request exceeds the limit, the API returns a 400 error. Split large pages into multiple requests if needed.

Using account aliases

If your access key is scoped to an account group, use the account field instead of specifying provider and region directly:

serviceDiscoveryRequests.push({
    service: 'ec2',
    account: 'prod-aws',
    attributes: ['name', 'instance_id', 'state']
});

The provider and region are resolved from the account group configuration. You can still override the region for cross-region queries:

serviceDiscoveryRequests.push({
    service: 's3',
    account: 'prod-aws',
    region: 'us-east-1'
});

Mock data for development

Set source: 'mock' to use local mock data without calling the API. Define mock data on the window object before loading the SDK:

<script>
    window.serviceEc2MockData = [
        { name: 'web-server-1', instance_id: 'i-0abc123', state: 'running' },
        { name: 'web-server-2', instance_id: 'i-0def456', state: 'stopped' }
    ];
</script>

<script>
    var serviceDiscoveryRequests = serviceDiscoveryRequests || [];
    serviceDiscoveryRequests.push({
        service: 'ec2',
        provider: 'aws',
        region: 'eu-west-2',
        source: 'mock'
    });
</script>

This is useful for building and styling pages before connecting a live cloud account.