apiaccess

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 1

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",
}

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) DeleteAPIAccessKey

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

DeleteAPIAccessKey deletes one or more keys.

func (*APIAccess) GetAPIAccessKey

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

GetAPIAccessKey returns a single API access key.

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) UpdateAPIAccessKeys

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

UpdateAPIAccessKeys 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"`
	// 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"`
}

APIAccessActorStitchedFields -

func (*APIAccessActorStitchedFields) UnmarshalJSON added in v0.52.0

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"`
	// Any notes about this ingest key. This can be updated later.
	Notes string `json:"notes"`
}

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"`
	// Create user keys. You can optionally add a name or notes to your key, which can be updated later.
	User []APIAccessCreateUserKeyInput `json:"user"`
}

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

type APIAccessCreateKeyResponse

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

APIAccessCreateKeyResponse - The response of the create keys mutation.

func (*APIAccessCreateKeyResponse) UnmarshalJSON added in v0.52.0

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"`
	// Any notes about this ingest key. This can be updated later.
	Notes string `json:"notes"`
	// 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"`
	// A list of the user key `id`s that you want to delete.
	UserKeyIDs []string `json:"userKeyIds"`
}

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"`
	// Lists all errors for keys that could not be deleted. Each error maps to a single key input.
	Errors []APIAccessKeyErrorInterface `json:"errors"`
}

APIAccessDeleteKeyResponse - The response of the key delete mutation.

func (*APIAccessDeleteKeyResponse) UnmarshalJSON added in v0.52.0

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

special

type APIAccessDeletedKey

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

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

type APIAccessIngestKey added in v0.52.0

type APIAccessIngestKey struct {
	// The account attached to the ingest key. Agents using this key will report to the account the key belongs to.
	AccountID int `json:"accountId"`
	// The UNIX epoch when the key was created, in seconds.
	CreatedAt EpochSeconds `json:"createdAt"`
	// 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"`
	// The type of ingest key, which dictates what types of agents can use it to report.
	IngestType APIAccessIngestKeyType `json:"ingestType"`
	// The keystring of the key.
	Key string `json:"key"`
	// The name of the key.
	Name string `json:"name"`
	// Any notes can be attached to an key.
	Notes string `json:"notes"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type"`
}

APIAccessIngestKey - An ingest key.

func (*APIAccessIngestKey) ImplementsAPIAccessKey added in v0.52.0

func (x *APIAccessIngestKey) ImplementsAPIAccessKey()

type APIAccessIngestKeyError added in v0.52.0

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

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

func (*APIAccessIngestKeyError) GetError added in v0.52.0

func (x *APIAccessIngestKeyError) GetError() error

Additional Interface methods

func (*APIAccessIngestKeyError) ImplementsAPIAccessKeyError added in v0.52.0

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 EpochSeconds `json:"createdAt"`
	// 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"`
	// The keystring of the key.
	Key string `json:"key"`
	// The name of the key. This can be used a short identifier for easy reference.
	Name string `json:"name"`
	// 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"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type"`
}

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"`
	// The type of the key.
	Type APIAccessKeyType `json:"type"`
}

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 added in v0.52.0

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

yes

type APIAccessKeyInterface

type APIAccessKeyInterface interface {
	ImplementsAPIAccessKey()
}

APIAccessKey - A key for accessing New Relic APIs.

func UnmarshalAPIAccessKeyInterface added in v0.52.0

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

yes

type APIAccessKeySearchQuery

type APIAccessKeySearchQuery struct {
	// Criteria by which to narrow the scope of keys to be returned.
	Scope APIAccessKeySearchScope `json:"scope"`
	// 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"`
	// A list of all keys scoped to the current actor.
	Keys []APIAccessKeyInterface `json:"keys"`
	// The next cursor, used for pagination. If a cursor is present, it means more keys can be fetched.
	NextCursor string `json:"nextCursor"`
}

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

func (*APIAccessKeySearchResult) UnmarshalJSON added in v0.52.0

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

special

type APIAccessKeySearchScope

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

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"`
	// The notes you want to assign to the key.
	Notes string `json:"notes"`
}

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"`
	// A list of the configurations of each user key you want to update.
	User []APIAccessUpdateUserKeyInput `json:"user"`
}

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"`
	// Lists all successfully updated keys.
	UpdatedKeys []APIAccessKeyInterface `json:"updatedKeys"`
}

APIAccessUpdateKeyResponse - The response of the update keys mutation.

func (*APIAccessUpdateKeyResponse) UnmarshalJSON added in v0.52.0

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"`
	// The notes you want to assign to the key.
	Notes string `json:"notes"`
}

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

type APIAccessUserKey added in v0.52.0

type APIAccessUserKey struct {
	// The account ID of the key.
	AccountID int `json:"accountId"`
	// The UNIX epoch when the key was created, in seconds.
	CreatedAt EpochSeconds `json:"createdAt"`
	// 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"`
	// The keystring of the key.
	Key string `json:"key"`
	// The name of the key.
	Name string `json:"name"`
	// Any notes can be attached to a key.
	Notes string `json:"notes"`
	// The type of key, indicating what New Relic APIs it can be used to access.
	Type APIAccessKeyType `json:"type"`
	// The user ID of the key.
	UserID int `json:"userId"`
}

APIAccessUserKey - A user key, also called a personal API key.

func (*APIAccessUserKey) ImplementsAPIAccessKey added in v0.52.0

func (x *APIAccessUserKey) ImplementsAPIAccessKey()

type APIAccessUserKeyError added in v0.52.0

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

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

func (*APIAccessUserKeyError) GetError added in v0.52.0

func (x *APIAccessUserKeyError) GetError() error

func (*APIAccessUserKeyError) ImplementsAPIAccessKeyError added in v0.52.0

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 EpochSeconds added in v0.52.0

type EpochSeconds string

EpochSeconds - The `EpochSeconds` scalar represents the number of seconds since the Unix epoch

Jump to

Keyboard shortcuts

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