Skip to content

Add resource_group_id parameter support to create_integration_instance method #49

@egallis31

Description

@egallis31

Description

The JupiterOne Python API client's create_integration_instance method is missing support for the resource_group_id parameter, which is available in the underlying GraphQL CREATE_INSTANCE mutation. This limitation forces users to make direct GraphQL calls instead of using the convenient client method.

Current Behavior

The create_integration_instance method only accepts these parameters:

  • instance_name (required)
  • instance_description (optional)
  • integration_definition_id (optional)

When attempting to create an integration instance that requires assignment to a specific resource group, the method fails because there's no way to specify the resourceGroupId.

Expected Behavior

The create_integration_instance method should accept a resource_group_id parameter to match the capabilities of the underlying GraphQL API.

Code Example

Current workaround (direct GraphQL call):

# Direct GraphQL mutation required for resource_group_id support
create_mutation = """
mutation CreateInstance($instance: CreateIntegrationInstanceInput!) {
    createIntegrationInstance(instance: $instance) {
        id
        name
        accountId
        pollingInterval
        integrationDefinitionId
        description
        config
    }
}
"""
variables = {
    "instance": {
        "name": "my-integration",
        "description": "Integration description",
        "integrationDefinitionId": "<integration-definition-id>",
        "resourceGroupId": "<resource-group-ip>"  # This parameter is missing from client method
    }
}

Desired client method usage:

# What we want to be able to do
integration = j1_client.create_integration_instance(
    instance_name="my-integration",
    instance_description="Integration description",
    integration_definition_id="<integration-definition-id>",
    resource_group_id="<resource-group-ip>"  # Add this parameter
)

Inconsistency with Other Methods

Interestingly, other client methods like create_alert_rule and update_alert_rule already support the resource_group_id parameter, making this omission inconsistent with the rest of the API client.

Example from alert rule methods:

# These methods already support resource_group_id
alert = j1_client.create_alert_rule(
    name="Test Alert",
    description="Alert description",
    polling_interval="DISABLED",
    j1ql="FIND jupiterone_account as a return a._accountId",
    severity="INFO",
    resource_group_id="<resource-group-id>"  # Already supported
)

Impact

This limitation affects:

  • Users who need to organize integrations within specific resource groups
  • Automated deployment scripts and CI/CD pipelines
  • Organizations with strict resource group governance requirements

Proposed Solution

Add resource_group_id as an optional parameter to the create_integration_instance method signature and include it in the GraphQL mutation variables when provided.

Environment

  • JupiterOne Python API Client: Latest version
  • Python: 3.13

Additional Context

This issue was discovered while implementing automated testing for JupiterOne IAM deployment validation, where integration instances need to be created within specific resource groups for proper access control testing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions