apiaccess

package
v2.41.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package apiaccess provides a programmatic API for interacting with New Relic API keys

Code generated by tutone: DO NOT EDIT

Index

Constants

This section is empty.

Variables

View Source
var APIAccessIngestKeyErrorTypeTypes = struct {
	// Occurs when the user issuing the mutation does not have sufficient permissions to perform the action for a key.
	FORBIDDEN APIAccessIngestKeyErrorType
	// Occurs when the action taken on a key did not successfully pass validation.
	INVALID APIAccessIngestKeyErrorType
	// Occurs when the requested key `id` was not found.
	NOT_FOUND APIAccessIngestKeyErrorType
}{

	FORBIDDEN: "FORBIDDEN",

	INVALID: "INVALID",

	NOT_FOUND: "NOT_FOUND",
}
View Source
var APIAccessIngestKeyTypeTypes = struct {
	// Ingest keys of type `BROWSER` mean browser agents will use them to report data to New Relic.
	BROWSER APIAccessIngestKeyType
	// For ingest keys of type `LICENSE`: APM and Infrastructure agents use the key to report data to New Relic.
	LICENSE APIAccessIngestKeyType
}{

	BROWSER: "BROWSER",

	LICENSE: "LICENSE",
}
View Source
var APIAccessKeyTypeTypes = struct {
	// An ingest key is used by New Relic agents to authenticate with New Relic and send data to the assigned account.
	INGEST APIAccessKeyType
	// A user key is used by New Relic users to authenticate with New Relic and to interact with the New Relic GraphQL API .
	USER APIAccessKeyType
}{

	INGEST: "INGEST",

	USER: "USER",
}
View Source
var APIAccessUserKeyErrorTypeTypes = struct {
	// Occurs when the user issuing the mutation does not have sufficient permissions to perform the action for a key.
	FORBIDDEN APIAccessUserKeyErrorType
	// Occurs when the action taken on a key did not successfully pass validation.
	INVALID APIAccessUserKeyErrorType
	// Occurs when the requested key `id` was not found.
	NOT_FOUND APIAccessUserKeyErrorType
}{

	FORBIDDEN: "FORBIDDEN",

	INVALID: "INVALID",

	NOT_FOUND: "NOT_FOUND",
}
View Source
var AccessKeyErrorPrefix = "The following errors have been thrown.\n"

Functions

This section is empty.

Types

type APIAccess

type APIAccess struct {
	// contains filtered or unexported fields
}

APIAccess is used to communicate with the New Relic APIKeys product.

func New

func New(config config.Config) APIAccess

New returns a new client for interacting with New Relic One entities.

func (*APIAccess) CreateAPIAccessKeys

func (a *APIAccess) CreateAPIAccessKeys(keys APIAccessCreateInput) ([]APIKey, error)

CreateAPIAccessKeys create keys. You can create keys for multiple accounts at once.

func (*APIAccess) CreateAPIAccessKeysWithContext

func (a *APIAccess) CreateAPIAccessKeysWithContext(ctx context.Context, keys APIAccessCreateInput) ([]APIKey, error)

CreateAPIAccessKeysWithContext create keys. You can create keys for multiple accounts at once.

func (*APIAccess) CreateInsightsInsertKey

func (a *APIAccess) CreateInsightsInsertKey(accountID int) (*InsightsKey, error)

func (*APIAccess) CreateInsightsInsertKeyWithContext

func (a *APIAccess) CreateInsightsInsertKeyWithContext(ctx context.Context, accountID int) (*InsightsKey, error)

func (*APIAccess) CreateInsightsQueryKey

func (a *APIAccess) CreateInsightsQueryKey(accountID int) (*InsightsKey, error)

func (*APIAccess) CreateInsightsQueryKeyWithContext

func (a *APIAccess) CreateInsightsQueryKeyWithContext(ctx context.Context, accountID int) (*InsightsKey, error)

func (*APIAccess) DeleteAPIAccessKey

func (a *APIAccess) DeleteAPIAccessKey(keys APIAccessDeleteInput) ([]APIAccessDeletedKey, error)

DeleteAPIAccessKey deletes one or more keys.

func (*APIAccess) DeleteAPIAccessKeyWithContext

func (a *APIAccess) DeleteAPIAccessKeyWithContext(ctx context.Context, keys APIAccessDeleteInput) ([]APIAccessDeletedKey, error)

DeleteAPIAccessKeyWithContext deletes one or more keys.

func (*APIAccess) DeleteInsightsInsertKey

func (a *APIAccess) DeleteInsightsInsertKey(accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) DeleteInsightsInsertKeyWithContext

func (a *APIAccess) DeleteInsightsInsertKeyWithContext(ctx context.Context, accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) DeleteInsightsQueryKey

func (a *APIAccess) DeleteInsightsQueryKey(accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) DeleteInsightsQueryKeyWithContext

func (a *APIAccess) DeleteInsightsQueryKeyWithContext(ctx context.Context, accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) GetAPIAccessKey

func (a *APIAccess) GetAPIAccessKey(keyID string, keyType APIAccessKeyType) (*APIKey, error)

GetAPIAccessKey returns a single API access key.

func (*APIAccess) GetAPIAccessKeyWithContext

func (a *APIAccess) GetAPIAccessKeyWithContext(ctx context.Context, keyID string, keyType APIAccessKeyType) (*APIKey, error)

GetAPIAccessKeyWithContext returns a single API access key.

func (*APIAccess) GetInsightsInsertKey

func (a *APIAccess) GetInsightsInsertKey(accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) GetInsightsInsertKeyWithContext

func (a *APIAccess) GetInsightsInsertKeyWithContext(ctx context.Context, accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) GetInsightsQueryKey

func (a *APIAccess) GetInsightsQueryKey(accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) GetInsightsQueryKeyWithContext

func (a *APIAccess) GetInsightsQueryKeyWithContext(ctx context.Context, accountID int, keyID int) (*InsightsKey, error)

func (*APIAccess) ListInsightsInsertKeys

func (a *APIAccess) ListInsightsInsertKeys(accountID int) ([]InsightsKey, error)

func (*APIAccess) ListInsightsInsertKeysWithContext

func (a *APIAccess) ListInsightsInsertKeysWithContext(ctx context.Context, accountID int) ([]InsightsKey, error)

func (*APIAccess) ListInsightsQueryKeys

func (a *APIAccess) ListInsightsQueryKeys(accountID int) ([]InsightsKey, error)

func (*APIAccess) ListInsightsQueryKeysWithContext

func (a *APIAccess) ListInsightsQueryKeysWithContext(ctx context.Context, accountID int) ([]InsightsKey, error)

func (*APIAccess) SearchAPIAccessKeys

func (a *APIAccess) SearchAPIAccessKeys(params APIAccessKeySearchQuery) ([]APIKey, error)

SearchAPIAccessKeys returns the relevant keys based on search criteria. Returns keys are scoped to the current user.

func (*APIAccess) SearchAPIAccessKeysWithContext

func (a *APIAccess) SearchAPIAccessKeysWithContext(ctx context.Context, params APIAccessKeySearchQuery) ([]APIKey, error)

SearchAPIAccessKeysWithContext returns the relevant keys based on search criteria. Returns keys are scoped to the current user.

func (*APIAccess) UpdateAPIAccessKeys

func (a *APIAccess) UpdateAPIAccessKeys(keys APIAccessUpdateInput) ([]APIKey, error)

UpdateAPIAccessKeys updates keys. You can update keys for multiple accounts at once.

func (*APIAccess) UpdateAPIAccessKeysWithContext

func (a *APIAccess) UpdateAPIAccessKeysWithContext(ctx context.Context, keys APIAccessUpdateInput) ([]APIKey, error)

UpdateAPIAccessKeysWithContext updates keys. You can update keys for multiple accounts at once.

type APIAccessActorStitchedFields

type APIAccessActorStitchedFields struct {
	// Fetch a single key by ID and type.
	Key APIAccessKeyInterface `json:"key,omitempty"`
	// A list of keys scoped to the current actor and filter arguments. You can read more about managing keys on [this documentation page](https://docs.newrelic.com/docs/apis/nerdgraph/examples/use-nerdgraph-manage-license-keys-personal-api-keys).
	KeySearch APIAccessKeySearchResult `json:"keySearch,omitempty"`
}

APIAccessActorStitchedFields -

func (*APIAccessActorStitchedFields) UnmarshalJSON

func (x *APIAccessActorStitchedFields) UnmarshalJSON(b []byte) error

special

type APIAccessCreateIngestKeyInput

type APIAccessCreateIngestKeyInput struct {
	// The account ID indicating which account you want to make the key for. This cannot be updated once created.
	AccountID int `json:"accountId"`
	// The type of ingest key you want to create. This cannot be updated once created.
	IngestType APIAccessIngestKeyType `json:"ingestType"`
	// The name of the key. This can be updated later.
	Name string `json:"name,omitempty"`
	// Any notes about this ingest key. This can be updated later.
	Notes string `json:"notes,omitempty"`
}

APIAccessCreateIngestKeyInput - The input for any ingest keys you want to create. Each ingest key must have a type that communicates what kind of data it is for. You can optionally add a name or notes to your key, which can be updated later.

type APIAccessCreateInput

type APIAccessCreateInput struct {
	// Ingest keys are used by agents to report data about your applications to New Relic. Each ingest key input entered here must have a type that communicates what kind of data it is for. You can optionally add a name or notes to your key, which can be updated later.
	Ingest []APIAccessCreateIngestKeyInput `json:"ingest,omitempty"`
	// Create user keys. You can optionally add a name or notes to your key, which can be updated later.
	User []APIAccessCreateUserKeyInput `json:"user,omitempty"`
}

APIAccessCreateInput - The input object to create one or more keys.

type APIAccessCreateKeyResponse

type APIAccessCreateKeyResponse struct {
	// Lists all successfully created keys.
	CreatedKeys []APIAccessKeyInterface `json:"createdKeys,omitempty"`
	// Lists all errors for keys that could not be created. Each error maps to a single key input.
	Errors []APIAccessKeyErrorInterface `json:"errors,omitempty"`
}

APIAccessCreateKeyResponse - The response of the create keys mutation.

func (*APIAccessCreateKeyResponse) UnmarshalJSON

func (x *APIAccessCreateKeyResponse) UnmarshalJSON(b []byte) error

special

type APIAccessCreateUserKeyInput

type APIAccessCreateUserKeyInput struct {
	// The account ID indicating which account you want to make the key for. This cannot be updated once created.
	AccountID int `json:"accountId"`
	// The name of the key. This can be updated later.
	Name string `json:"name,omitempty"`
	// Any notes about this ingest key. This can be updated later.
	Notes string `json:"notes,omitempty"`
	// The user ID indicating which user you want to make the key for. This cannot be updated once created.
	UserID int `json:"userId"`
}

APIAccessCreateUserKeyInput - The input for any ingest keys you want to create. Each ingest key must have a type that communicates what kind of data it is for. You can optionally add a name or notes to your key, which can be updated later.

type APIAccessDeleteInput

type APIAccessDeleteInput struct {
	// A list of the ingest key `id`s that you want to delete.
	IngestKeyIDs []string `json:"ingestKeyIds,omitempty"`
	// A list of the user key `id`s that you want to delete.
	UserKeyIDs []string `json:"userKeyIds,omitempty"`
}

APIAccessDeleteInput - The input to delete keys.

type APIAccessDeleteKeyResponse

type APIAccessDeleteKeyResponse struct {
	// The `id`s of the successfully deleted ingest keys and any errors that occurred when deleting keys.
	DeletedKeys []APIAccessDeletedKey `json:"deletedKeys,omitempty"`
	// Lists all errors for keys that could not be deleted. Each error maps to a single key input.
	Errors []APIAccessKeyErrorInterface `json:"errors,omitempty"`
}

APIAccessDeleteKeyResponse - The response of the key delete mutation.

func (*APIAccessDeleteKeyResponse) UnmarshalJSON

func (x *APIAccessDeleteKeyResponse) UnmarshalJSON(b []byte) error

special

type APIAccessDeletedKey

type APIAccessDeletedKey struct {
	// The `id` of the deleted key.
	ID string `json:"id,omitempty"`
}

APIAccessDeletedKey - The deleted key response of the key delete mutation.

type APIAccessIngestKey

type APIAccessIngestKey struct {
	// The account this key is in.
	Account accounts.AccountReference `json:"account,omitempty"`
	// The account attached to the ingest key. Agents using this key will report to the account the key belongs to.
	AccountID int `json:"accountId,omitempty"`
	// The UNIX epoch when the key was created, in seconds.
	CreatedAt int64 `json:"createdAt,omitempty"`
	// The ID of the ingest key. This can be used to identify a key without revealing the key itself (used to update and delete).
	ID string `json:"id,omitempty"`
	// The type of ingest key, which dictates what types of agents can use it to report.
	IngestType APIAccessIngestKeyType `json:"ingestType,omitempty"`
	// The keystring of the key.
	Key string `json:"key,omitempty"`
	// The name of the key. Limited to 120 characters.
	Name string `json:"name,omitempty"`
	// Any notes can be attached to an key. Limited to 120 characters.
	Notes string `json:"notes,omitempty"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type,omitempty"`
}

APIAccessIngestKey - An ingest key.

func (*APIAccessIngestKey) ImplementsAPIAccessKey

func (x *APIAccessIngestKey) ImplementsAPIAccessKey()

type APIAccessIngestKeyError

type APIAccessIngestKeyError struct {
	// The account ID of the key.
	AccountID int `json:"accountId,omitempty"`
	// The error type of the error.
	ErrorType APIAccessIngestKeyErrorType `json:"errorType,omitempty"`
	// The `id` of the key being updated.
	ID string `json:"id,omitempty"`
	// The ingest type of the key.
	IngestType APIAccessIngestKeyType `json:"ingestType,omitempty"`
	// A message about why the key creation failed.
	Message string `json:"message,omitempty"`
	// The type of the key.
	Type APIAccessKeyType `json:"type,omitempty"`
}

APIAccessIngestKeyError - An ingest key error. Each error maps to a single key input.

func (*APIAccessIngestKeyError) GetError

func (x *APIAccessIngestKeyError) GetError() error

Additional Interface methods

func (*APIAccessIngestKeyError) ImplementsAPIAccessKeyError

func (x *APIAccessIngestKeyError) ImplementsAPIAccessKeyError()

type APIAccessIngestKeyErrorType

type APIAccessIngestKeyErrorType string

APIAccessIngestKeyErrorType - The type of error.

type APIAccessIngestKeyType

type APIAccessIngestKeyType string

APIAccessIngestKeyType - The type of ingest key, which dictates what types of agents can use it to report.

type APIAccessKey

type APIAccessKey struct {
	// The UNIX epoch when the key was created, in seconds.
	CreatedAt int64 `json:"createdAt,omitempty"`
	// The ID of the key. This can be used to identify a key without revealing the key itself (used to update and delete).
	ID string `json:"id,omitempty"`
	// The keystring of the key.
	Key string `json:"key,omitempty"`
	// The name of the key. This can be used as a short identifier for easy reference.
	Name string `json:"name,omitempty"`
	// Any notes can be attached to a key. This is intended for more a more detailed description of the key use if desired.
	Notes string `json:"notes,omitempty"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type,omitempty"`
}

APIAccessKey - A key for accessing New Relic APIs.

func (*APIAccessKey) ImplementsAPIAccessKey

func (x *APIAccessKey) ImplementsAPIAccessKey()

type APIAccessKeyError

type APIAccessKeyError struct {
	// A message about why the key creation failed.
	Message string `json:"message,omitempty"`
	// The type of the key.
	Type APIAccessKeyType `json:"type,omitempty"`
}

APIAccessKeyError - A key error. Each error maps to a single key input.

func (*APIAccessKeyError) ImplementsAPIAccessKeyError

func (x *APIAccessKeyError) ImplementsAPIAccessKeyError()

type APIAccessKeyErrorInterface

type APIAccessKeyErrorInterface interface {
	ImplementsAPIAccessKeyError()
	GetError() error
}

APIAccessKeyError - A key error. Each error maps to a single key input.

func UnmarshalAPIAccessKeyErrorInterface

func UnmarshalAPIAccessKeyErrorInterface(b []byte) (*APIAccessKeyErrorInterface, error)

UnmarshalAPIAccessKeyErrorInterface unmarshals the interface into the correct type based on __typename provided by GraphQL

type APIAccessKeyErrorResponse added in v2.17.1

type APIAccessKeyErrorResponse struct {
	// The message with the error cause.
	Message string `json:"message,omitempty"`
	// Type of error.
	Type               string                      `json:"type,omitempty"`
	UserKeyErrorType   APIAccessUserKeyErrorType   `json:"userErrorType,omitempty"`
	IngestKeyErrorType APIAccessIngestKeyErrorType `json:"ingestErrorType,omitempty"`
	ID                 string                      `json:"id,omitempty"`
}

type APIAccessKeyInterface

type APIAccessKeyInterface interface {
	ImplementsAPIAccessKey()
}

APIAccessKey - A key for accessing New Relic APIs.

func UnmarshalAPIAccessKeyInterface

func UnmarshalAPIAccessKeyInterface(b []byte) (*APIAccessKeyInterface, error)

UnmarshalAPIAccessKeyInterface unmarshals the interface into the correct type based on __typename provided by GraphQL

type APIAccessKeySearchQuery

type APIAccessKeySearchQuery struct {
	// Criteria by which to narrow the scope of keys to be returned.
	Scope APIAccessKeySearchScope `json:"scope,omitempty"`
	// A list of key types to be included in the search. If no types are provided, all types will be returned by default.
	Types []APIAccessKeyType `json:"types"`
}

APIAccessKeySearchQuery - Parameters by which to filter the search.

type APIAccessKeySearchResult

type APIAccessKeySearchResult struct {
	// The total number of keys found in scope, irrespective of pagination.
	Count int `json:"count,omitempty"`
	// A list of all keys scoped to the current actor.
	Keys []APIAccessKeyInterface `json:"keys,omitempty"`
	// The next cursor, used for pagination. If a cursor is present, it means more keys can be fetched.
	NextCursor string `json:"nextCursor,omitempty"`
}

APIAccessKeySearchResult - A list of all keys scoped to the current actor.

func (*APIAccessKeySearchResult) UnmarshalJSON

func (x *APIAccessKeySearchResult) UnmarshalJSON(b []byte) error

special

type APIAccessKeySearchScope

type APIAccessKeySearchScope struct {
	// A list of key account IDs.
	AccountIDs []int `json:"accountIds,omitempty"`
	// The ingest type of the key. Only applies to ingest keys, and does not affect user key filtering.
	IngestTypes []APIAccessIngestKeyType `json:"ingestTypes,omitempty"`
	// A list of key user ids. Only applies to user keys, and does not affect ingest key filtering.
	UserIDs []int `json:"userIds,omitempty"`
}

APIAccessKeySearchScope - The scope of keys to be returned. Note that some filters only apply to certain key types.

type APIAccessKeyType

type APIAccessKeyType string

APIAccessKeyType - The type of key.

type APIAccessUpdateIngestKeyInput

type APIAccessUpdateIngestKeyInput struct {
	// The `id` of the key you want to update.
	KeyID string `json:"keyId"`
	// The name you want to assign to the key.
	Name string `json:"name,omitempty"`
	// The notes you want to assign to the key.
	Notes string `json:"notes,omitempty"`
}

APIAccessUpdateIngestKeyInput - The `id` and data to update one or more keys.

type APIAccessUpdateInput

type APIAccessUpdateInput struct {
	// A list of the configurations of each ingest key you want to update.
	Ingest []APIAccessUpdateIngestKeyInput `json:"ingest,omitempty"`
	// A list of the configurations of each user key you want to update.
	User []APIAccessUpdateUserKeyInput `json:"user,omitempty"`
}

APIAccessUpdateInput - The `id` and data to update one or more keys.

type APIAccessUpdateKeyResponse

type APIAccessUpdateKeyResponse struct {
	// Lists all errors for keys that could not be updated. Each error maps to a single key input.
	Errors []APIAccessKeyErrorInterface `json:"errors,omitempty"`
	// Lists all successfully updated keys.
	UpdatedKeys []APIAccessKeyInterface `json:"updatedKeys,omitempty"`
}

APIAccessUpdateKeyResponse - The response of the update keys mutation.

func (*APIAccessUpdateKeyResponse) UnmarshalJSON

func (x *APIAccessUpdateKeyResponse) UnmarshalJSON(b []byte) error

special

type APIAccessUpdateUserKeyInput

type APIAccessUpdateUserKeyInput struct {
	// The `id` of the key you want to update.
	KeyID string `json:"keyId"`
	// The name you want to assign to the key.
	Name string `json:"name,omitempty"`
	// The notes you want to assign to the key.
	Notes string `json:"notes,omitempty"`
}

APIAccessUpdateUserKeyInput - The `id` and data to update one or more keys.

type APIAccessUserKey

type APIAccessUserKey struct {
	// The account this key is in.
	Account accounts.AccountReference `json:"account,omitempty"`
	// The account ID of the key.
	AccountID int `json:"accountId,omitempty"`
	// The UNIX epoch when the key was created, in seconds.
	CreatedAt int64 `json:"createdAt,omitempty"`
	// The ID of the user key. This can be used to identify a key without revealing the key itself (used to update and delete).
	ID string `json:"id,omitempty"`
	// The keystring of the key.
	Key string `json:"key,omitempty"`
	// The name of the key. Limited to 120 characters.
	Name string `json:"name,omitempty"`
	// Any notes can be attached to a key. Limited to 120 characters.
	Notes string `json:"notes,omitempty"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type,omitempty"`
	// The user this key belongs to.
	User users.UserReference `json:"user,omitempty"`
	// The user ID of the key.
	UserID int `json:"userId,omitempty"`
}

APIAccessUserKey - A user key.

func (*APIAccessUserKey) ImplementsAPIAccessKey

func (x *APIAccessUserKey) ImplementsAPIAccessKey()

type APIAccessUserKeyError

type APIAccessUserKeyError struct {
	// The account ID of the key.
	AccountID int `json:"accountId,omitempty"`
	// The error type of the error.
	ErrorType APIAccessUserKeyErrorType `json:"errorType,omitempty"`
	// The `id` of the key being updated.
	ID string `json:"id,omitempty"`
	// A message about why the key creation failed.
	Message string `json:"message,omitempty"`
	// The type of the key.
	Type APIAccessKeyType `json:"type,omitempty"`
	// The user ID of the key.
	UserID int `json:"userId,omitempty"`
}

APIAccessUserKeyError - A user key error. Each error maps to a single key input.

func (*APIAccessUserKeyError) GetError

func (x *APIAccessUserKeyError) GetError() error

func (*APIAccessUserKeyError) ImplementsAPIAccessKeyError

func (x *APIAccessUserKeyError) ImplementsAPIAccessKeyError()

type APIAccessUserKeyErrorType

type APIAccessUserKeyErrorType string

APIAccessUserKeyErrorType - The type of error.

type APIKey

type APIKey struct {
	APIAccessKey

	AccountID  *int                   `json:"accountId,omitempty"`
	IngestType APIAccessIngestKeyType `json:"ingestType,omitempty"`
	UserID     *int                   `json:"userId,omitempty"`
}

type InsightsKey

type InsightsKey struct {
	ID        int       `json:"id"`
	AccountID int       `json:"account_id"`
	Key       string    `json:"key"`
	Notes     string    `json:"notes"`
	IsEnabled bool      `json:"is_enabled"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL