Skip to content

Latest commit

 

History

History
162 lines (117 loc) · 9.49 KB

File metadata and controls

162 lines (117 loc) · 9.49 KB

Sources.HecTokens

Overview

Available Operations

  • create - Add an HEC token and optional metadata to a Splunk HEC Source
  • update - Update metadata for an HEC token for a Splunk HEC Source

create

Add an HEC token and optional metadata to the specified Splunk HEC Source.

Example Usage: HecTokenExamplesHecToken

from cribl_control_plane import CriblControlPlane, models
import os


with CriblControlPlane(
    "https://api.example.com",
    security=models.Security(
        bearer_auth=os.getenv("CRIBLCONTROLPLANE_BEARER_AUTH", ""),
    ),
) as ccp_client:

    res = ccp_client.sources.hec_tokens.create(id="<id>", token="12345678901", enabled=True, metadata=[
        {
            "name": "fieldX",
            "value": "valueX",
        },
    ])

    # Handle response
    print(res)

Example Usage: HecTokenExamplesHecTokenWithIndexAccess

from cribl_control_plane import CriblControlPlane, models
import os


with CriblControlPlane(
    "https://api.example.com",
    security=models.Security(
        bearer_auth=os.getenv("CRIBLCONTROLPLANE_BEARER_AUTH", ""),
    ),
) as ccp_client:

    res = ccp_client.sources.hec_tokens.create(id="<id>", token="12345678901", allowed_indexes_at_token=[
        "myIndex6",
    ], enabled=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The id of the Splunk HEC Source.
token str ✔️ N/A
allowed_indexes_at_token List[str] N/A
description Optional[str] N/A
enabled Optional[bool] N/A
metadata List[models.EventBreakerRuleFields] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CountedInputSplunkHec

Errors

Error Type Status Code Content Type
errors.Error 500 application/json
errors.APIError 4XX, 5XX */*

update

Update the metadata for the specified HEC token for the specified Splunk HEC Source.

Example Usage: HecTokenExamplesHecToken

from cribl_control_plane import CriblControlPlane, models
import os


with CriblControlPlane(
    "https://api.example.com",
    security=models.Security(
        bearer_auth=os.getenv("CRIBLCONTROLPLANE_BEARER_AUTH", ""),
    ),
) as ccp_client:

    res = ccp_client.sources.hec_tokens.update(id="<id>", token="<value>", enabled=True, metadata=[
        {
            "name": "fieldX",
            "value": "valueX",
        },
    ])

    # Handle response
    print(res)

Example Usage: HecTokenExamplesHecTokenWithIndexAccess

from cribl_control_plane import CriblControlPlane, models
import os


with CriblControlPlane(
    "https://api.example.com",
    security=models.Security(
        bearer_auth=os.getenv("CRIBLCONTROLPLANE_BEARER_AUTH", ""),
    ),
) as ccp_client:

    res = ccp_client.sources.hec_tokens.update(id="<id>", token="<value>", allowed_indexes_at_token=[
        "myIndex6",
    ], enabled=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ The id of the Splunk HEC Source.
token str ✔️ The id of the HEC token to update.
allowed_indexes_at_token List[str] N/A
description Optional[str] N/A
enabled Optional[bool] N/A
metadata List[models.EventBreakerRuleFields] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CountedInputSplunkHec

Errors

Error Type Status Code Content Type
errors.Error 500 application/json
errors.APIError 4XX, 5XX */*