Credentials
Imports¶
Python modules
from typing import UnionThird-party modules
from sgqlc.operation import Operationnewrelic_sb_sdk module
from newrelic_sb_sdk.client import NewRelicClient
from newrelic_sb_sdk.graphql.objects import Account, User
from newrelic_sb_sdk.utils.response import raise_response_errorsFunctions¶
validate¶
Performs an authentication test confirming that the tied credentials grant valid New Relic access.
def validate(*, client: NewRelicClient, account: Account | None = None) -> User:
"""Validate SDK configuration with New Relic credentials.
Args:
client: The New Relic API client instance for authentication.
account: The target New Relic account object. Defaults to None.
Returns:
The verified User profile object.
"""
operation = Operation(
client.schema.query_type,
)
operation.actor.user.__fields__(
"id",
"email",
"name",
)
response = client.execute(operation)
raise_response_errors(
response=response,
account=account,
)
data = operation + response.json()
data = data.actor.user
return data