Documentation
¶
Overview ¶
Package synthetics provides a programmatic API for interacting with the New Relic Synthetics API. It can be used for a variety of operations, including:
- Creating, reading, updating, and deleting Synthetics monitors
- Reading and updating Synthetics monitor scripts
- Associating Synthetics monitor scripts with existing Synthetics monitors
- Creating, reading, updating, and deleting Synthetics secure credentials
Synthetics labels have been EOL'd as of July 20, 2020. This functionality has been superceded by entity tags, which can be provisioned via the `entities` package. More information can be found here:
Authentication ¶
You will need a Personal API key to communicate with the backend New Relic API that provides this functionality. See the API key documentation below for more information on how to locate this keys:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
Package synthetics provides a programmatic API for interacting with the New Relic Synthetics product.
Code generated by tutone: DO NOT EDIT
Code generated by tutone: DO NOT EDIT
Example (Monitor) ¶
// Initialize the client configuration. A Personal API key is required to // communicate with the backend API. cfg := config.New() cfg.PersonalAPIKey = os.Getenv("NEW_RELIC_API_KEY") // Initialize the client. client := New(cfg) // Create a simple Synthetics monitor. simpleMonitor := Monitor{ Name: "Example monitor", Type: MonitorTypes.Ping, Status: MonitorStatus.Enabled, SLAThreshold: 2.0, URI: "https://www.example.com", Frequency: 5, Locations: []string{"AWS_US_EAST_1"}, } created, err := client.CreateMonitor(simpleMonitor) if err != nil { log.Fatal("error creating Synthetics monitor: ", err) } // Create a scripted browser monitor. scriptedBrowser := Monitor{ Name: "Example scriptied browser monitor", Type: MonitorTypes.ScriptedBrowser, Status: MonitorStatus.Enabled, SLAThreshold: 2.0, URI: "https://www.example.com", Frequency: 1440, Locations: []string{"AWS_US_EAST_1", "AWS_US_WEST_1"}, } monitorScript := MonitorScript{ Text: ` var assert = require("assert"); $browser.get("http://www.example.com").then(function(){ // Check the H1 title matches "Example Domain" return $browser.findElement($driver.By.css("h1")).then(function(element){ return element.getText().then(function(text){ assert.equal("Example Domain", text, "Page H1 title did not match"); }); }); })`, } created, err = client.CreateMonitor(scriptedBrowser) if err != nil { log.Fatal("error creating Synthetics monitor: ", err) } _, err = client.UpdateMonitorScript(created.ID, monitorScript) if err != nil { log.Fatal("error updating Synthetics monitor script: ", err) } // Update an existing Synthetics monitor script. created.Locations = []string{"AWS_US_WEST_1"} updated, err := client.UpdateMonitor(*created) if err != nil { log.Fatal("error updating Synthetics monitor: ", err) } // Delete an existing Synthetics monitor script. err = client.DeleteMonitor(updated.ID) if err != nil { log.Fatal("error deleting Synthetics monitor: ", err) } // Get all valid Synthetics monitor locations. locations, err := client.GetMonitorLocations() if err != nil { log.Fatal("error retrieving valid Synthetics monitor locations: ", err) } log.Printf("found %d valid Synthetics monitor locations", len(locations))
Output:
Example (SecureCredentials) ¶
// Initialize the client configuration. cfg := config.New() cfg.PersonalAPIKey = os.Getenv("NEW_RELIC_API_KEY") // Initialize the client. client := New(cfg) // Get the Synthetics secure credentials for this account. credentials, err := client.GetSecureCredentials() if err != nil { log.Fatal("error getting Synthetics secure credentials: ", err) } // Get a single Synthetics secure credential belonging to this account. credential, err := client.GetSecureCredential(credentials[0].Key) if err != nil { log.Fatal("error getting Synthetics secure credential: ", err) } // Add a secure credential for use with Synthetics. credential, err = client.AddSecureCredential("key", "value", "description") if err != nil { log.Fatal("error adding Synthetics secure credential: ", err) } // Delete a Synthetics secure credential. err = client.DeleteSecureCredential(credential.Key) if err != nil { log.Fatal("error deleting Synthetics secure credential: ", err) }
Output:
Index ¶
- Constants
- Variables
- type EntityGUID
- type ErrorDetail
- type ErrorResponse
- type Monitor
- type MonitorLocationdeprecated
- type MonitorOptions
- type MonitorScript
- type MonitorScriptLocation
- type MonitorStatusType
- type MonitorType
- type SecureCredential
- type SecureValue
- type Synthetics
- func (s *Synthetics) AddSecureCredential(key, value, description string) (*SecureCredential, error)deprecated
- func (s *Synthetics) AddSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error)deprecated
- func (s *Synthetics) CreateMonitor(monitor Monitor) (*Monitor, error)
- func (s *Synthetics) CreateMonitorWithContext(ctx context.Context, monitor Monitor) (*Monitor, error)
- func (s *Synthetics) DeleteMonitor(monitorID string) error
- func (s *Synthetics) DeleteMonitorWithContext(ctx context.Context, monitorID string) error
- func (s *Synthetics) DeleteSecureCredential(key string) errordeprecated
- func (s *Synthetics) DeleteSecureCredentialWithContext(ctx context.Context, key string) errordeprecated
- func (s *Synthetics) GetMonitor(monitorID string) (*Monitor, error)
- func (s *Synthetics) GetMonitorLocations() ([]*MonitorLocation, error)deprecated
- func (s *Synthetics) GetMonitorLocationsWithContext(ctx context.Context) ([]*MonitorLocation, error)deprecated
- func (s *Synthetics) GetMonitorScript(monitorID string) (*MonitorScript, error)
- func (s *Synthetics) GetMonitorScriptWithContext(ctx context.Context, monitorID string) (*MonitorScript, error)
- func (s *Synthetics) GetMonitorWithContext(ctx context.Context, monitorID string) (*Monitor, error)
- func (s *Synthetics) GetSecureCredential(key string) (*SecureCredential, error)deprecated
- func (s *Synthetics) GetSecureCredentialWithContext(ctx context.Context, key string) (*SecureCredential, error)deprecated
- func (s *Synthetics) GetSecureCredentials() ([]*SecureCredential, error)deprecated
- func (s *Synthetics) GetSecureCredentialsWithContext(ctx context.Context) ([]*SecureCredential, error)deprecated
- func (s *Synthetics) ListMonitors() ([]*Monitor, error)
- func (s *Synthetics) ListMonitorsWithContext(ctx context.Context) ([]*Monitor, error)
- func (a *Synthetics) SyntheticsCreatePrivateLocation(accountID int, description string, name string, verifiedScriptExecution bool) (*SyntheticsPrivateLocationMutationResult, error)
- func (a *Synthetics) SyntheticsCreatePrivateLocationWithContext(ctx context.Context, accountID int, description string, name string, ...) (*SyntheticsPrivateLocationMutationResult, error)
- func (a *Synthetics) SyntheticsCreateSecureCredential(accountID int, description string, key string, value SecureValue) (*SyntheticsSecureCredentialMutationResult, error)
- func (a *Synthetics) SyntheticsCreateSecureCredentialWithContext(ctx context.Context, accountID int, description string, key string, ...) (*SyntheticsSecureCredentialMutationResult, error)
- func (a *Synthetics) SyntheticsDeletePrivateLocation(gUID EntityGUID) (*SyntheticsPrivateLocationDeleteResult, error)
- func (a *Synthetics) SyntheticsDeletePrivateLocationWithContext(ctx context.Context, gUID EntityGUID) (*SyntheticsPrivateLocationDeleteResult, error)
- func (a *Synthetics) SyntheticsDeleteSecureCredential(accountID int, key string) (*SyntheticsSecureCredentialMutationResult, error)
- func (a *Synthetics) SyntheticsDeleteSecureCredentialWithContext(ctx context.Context, accountID int, key string) (*SyntheticsSecureCredentialMutationResult, error)
- func (a *Synthetics) SyntheticsPurgePrivateLocationQueue(gUID EntityGUID) (*SyntheticsPrivateLocationPurgeQueueResult, error)
- func (a *Synthetics) SyntheticsPurgePrivateLocationQueueWithContext(ctx context.Context, gUID EntityGUID) (*SyntheticsPrivateLocationPurgeQueueResult, error)
- func (a *Synthetics) SyntheticsUpdatePrivateLocation(description string, gUID EntityGUID, verifiedScriptExecution bool) (*SyntheticsPrivateLocationMutationResult, error)
- func (a *Synthetics) SyntheticsUpdatePrivateLocationWithContext(ctx context.Context, description string, gUID EntityGUID, ...) (*SyntheticsPrivateLocationMutationResult, error)
- func (a *Synthetics) SyntheticsUpdateSecureCredential(accountID int, description string, key string, value SecureValue) (*SyntheticsSecureCredentialMutationResult, error)
- func (a *Synthetics) SyntheticsUpdateSecureCredentialWithContext(ctx context.Context, accountID int, description string, key string, ...) (*SyntheticsSecureCredentialMutationResult, error)
- func (s *Synthetics) UpdateMonitor(monitor Monitor) (*Monitor, error)
- func (s *Synthetics) UpdateMonitorScript(monitorID string, script MonitorScript) (*MonitorScript, error)
- func (s *Synthetics) UpdateMonitorScriptWithContext(ctx context.Context, monitorID string, script MonitorScript) (*MonitorScript, error)
- func (s *Synthetics) UpdateMonitorWithContext(ctx context.Context, monitor Monitor) (*Monitor, error)
- func (s *Synthetics) UpdateSecureCredential(key, value, description string) (*SecureCredential, error)deprecated
- func (s *Synthetics) UpdateSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error)deprecated
- type SyntheticsCreatePrivateLocationQueryResponse
- type SyntheticsCreateSecureCredentialQueryResponse
- type SyntheticsDeletePrivateLocationQueryResponse
- type SyntheticsDeleteSecureCredentialQueryResponse
- type SyntheticsError
- type SyntheticsPrivateLocationDeleteResult
- type SyntheticsPrivateLocationMutationError
- type SyntheticsPrivateLocationMutationErrorType
- type SyntheticsPrivateLocationMutationResult
- type SyntheticsPrivateLocationPurgeQueueResult
- type SyntheticsPurgePrivateLocationQueueQueryResponse
- type SyntheticsSecureCredentialMutationResult
- type SyntheticsUpdatePrivateLocationQueryResponse
- type SyntheticsUpdateSecureCredentialQueryResponse
- type Time
Examples ¶
Constants ¶
const SyntheticsCreatePrivateLocationMutation = `` /* 390-byte string literal not displayed */
const SyntheticsCreateSecureCredentialMutation = `` /* 284-byte string literal not displayed */
const SyntheticsDeletePrivateLocationMutation = `mutation(
$guid: EntityGuid!,
) { syntheticsDeletePrivateLocation(
guid: $guid,
) {
errors {
description
type
}
} }`
const SyntheticsDeleteSecureCredentialMutation = `` /* 194-byte string literal not displayed */
const SyntheticsPurgePrivateLocationQueueMutation = `` /* 127-byte string literal not displayed */
const SyntheticsUpdatePrivateLocationMutation = `` /* 350-byte string literal not displayed */
const SyntheticsUpdateSecureCredentialMutation = `` /* 283-byte string literal not displayed */
Variables ¶
var ( // MonitorTypes specifies the possible types for a Synthetics monitor. MonitorTypes = struct { Ping MonitorType Browser MonitorType ScriptedBrowser MonitorType APITest MonitorType }{ Ping: "SIMPLE", Browser: "BROWSER", ScriptedBrowser: "SCRIPT_BROWSER", APITest: "SCRIPT_API", } // MonitorStatus specifies the possible Synthetics monitor status types. MonitorStatus = struct { Enabled MonitorStatusType Muted MonitorStatusType Disabled MonitorStatusType }{ Enabled: "ENABLED", Muted: "MUTED", Disabled: "DISABLED", } )
var SyntheticsPrivateLocationMutationErrorTypeTypes = struct { // Received a request missing required fields or containing invalid data BAD_REQUEST SyntheticsPrivateLocationMutationErrorType // An unknown error occured while processing request to purge specified private location job queue INTERNAL_SERVER_ERROR SyntheticsPrivateLocationMutationErrorType // Private location not found for key (private location does not exist on account or has already been deleted) NOT_FOUND SyntheticsPrivateLocationMutationErrorType // User does not have authorization to purge job queue for specified private location UNAUTHORIZED SyntheticsPrivateLocationMutationErrorType }{ BAD_REQUEST: "BAD_REQUEST", INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR", NOT_FOUND: "NOT_FOUND", UNAUTHORIZED: "UNAUTHORIZED", }
Functions ¶
This section is empty.
Types ¶
type ErrorDetail ¶
type ErrorDetail struct {
Message string `json:"error,omitempty"`
}
ErrorDetail represents an single error from New Relic Synthetics.
type ErrorResponse ¶
type ErrorResponse struct { http.DefaultErrorResponse Message string `json:"error,omitempty"` Messages []ErrorDetail `json:"errors,omitempty"` ServerErrorMessage string `json:"message,omitempty"` }
ErrorResponse represents an error response from New Relic Synthetics.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
Error surfaces an error message from the New Relic Synthetics error response.
func (*ErrorResponse) New ¶ added in v0.13.0
func (e *ErrorResponse) New() http.ErrorResponse
New creates a new instance of ErrorResponse.
type Monitor ¶
type Monitor struct { ID string `json:"id,omitempty"` Name string `json:"name"` Type MonitorType `json:"type"` Frequency uint `json:"frequency"` URI string `json:"uri"` Locations []string `json:"locations"` Status MonitorStatusType `json:"status"` SLAThreshold float64 `json:"slaThreshold"` UserID uint `json:"userId,omitempty"` APIVersion string `json:"apiVersion,omitempty"` ModifiedAt *Time `json:"modifiedAt,omitempty"` CreatedAt *Time `json:"createdAt,omitempty"` Options MonitorOptions `json:"options,omitempty"` }
Monitor represents a New Relic Synthetics monitor.
type MonitorLocation
deprecated
added in
v0.32.0
type MonitorLocation struct { HighSecurityMode bool `json:"highSecurityMode"` Private bool `json:"private"` Name string `json:"name"` Label string `json:"label"` Description string `json:"description"` }
Deprecated: MonitorLocation is now a considered an Entity and adheres to the SyntheticMonitorEntityOutline interface. MonitorLocation represents a valid location for a New Relic Synthetics monitor.
type MonitorOptions ¶
type MonitorOptions struct { ValidationString string `json:"validationString,omitempty"` VerifySSL bool `json:"verifySSL,omitempty"` BypassHEADRequest bool `json:"bypassHEADRequest,omitempty"` TreatRedirectAsFailure bool `json:"treatRedirectAsFailure,omitempty"` }
MonitorOptions represents the options for a New Relic Synthetics monitor.
type MonitorScript ¶
type MonitorScript struct { Text string `json:"scriptText"` Locations []MonitorScriptLocation `json:"scriptLocations"` }
MonitorScript represents a New Relic Synthetics monitor script.
type MonitorScriptLocation ¶
MonitorScriptLocation represents a New Relic Synthetics monitor script location.
type MonitorStatusType ¶
type MonitorStatusType string
MonitorStatusType represents a Synthetics monitor status type.
type SecureCredential ¶ added in v0.10.0
type SecureCredential struct { Key string `json:"key"` Description string `json:"description"` Value string `json:"value"` CreatedAt *Time `json:"createdAt"` LastUpdated *Time `json:"lastUpdated"` }
SecureCredential represents a Synthetics secure credential.
type SecureValue ¶ added in v0.79.0
type SecureValue string
SecureValue - The `SecureValue` scalar represents a secure value, ie a password, an API key, etc.
type Synthetics ¶
type Synthetics struct {
// contains filtered or unexported fields
}
Synthetics is used to communicate with the New Relic Synthetics product.
func New ¶
func New(config config.Config) Synthetics
New is used to create a new Synthetics client instance.
func (*Synthetics) AddSecureCredential
deprecated
added in
v0.10.0
func (s *Synthetics) AddSecureCredential(key, value, description string) (*SecureCredential, error)
Deprecated: Use synthetics.SyntheticsCreateSecureCredential instead.
func (*Synthetics) AddSecureCredentialWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) AddSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error)
Deprecated: Use synthetics.SyntheticsCreateSecureCredentialWithContext instead.
func (*Synthetics) CreateMonitor ¶
func (s *Synthetics) CreateMonitor(monitor Monitor) (*Monitor, error)
CreateMonitor is used to create a New Relic Synthetics monitor.
func (*Synthetics) CreateMonitorWithContext ¶ added in v0.60.0
func (s *Synthetics) CreateMonitorWithContext(ctx context.Context, monitor Monitor) (*Monitor, error)
CreateMonitorWithContext is used to create a New Relic Synthetics monitor.
func (*Synthetics) DeleteMonitor ¶
func (s *Synthetics) DeleteMonitor(monitorID string) error
DeleteMonitor is used to delete a New Relic Synthetics monitor.
func (*Synthetics) DeleteMonitorWithContext ¶ added in v0.60.0
func (s *Synthetics) DeleteMonitorWithContext(ctx context.Context, monitorID string) error
DeleteMonitorWithContext is used to delete a New Relic Synthetics monitor.
func (*Synthetics) DeleteSecureCredential
deprecated
added in
v0.10.0
func (s *Synthetics) DeleteSecureCredential(key string) error
Deprecated: Use synthetics.SyntheticsDeleteSecureCredential instead
func (*Synthetics) DeleteSecureCredentialWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) DeleteSecureCredentialWithContext(ctx context.Context, key string) error
Deprecated: Use synthetics.SyntheticsDeleteSecureCredentialWithContext instead
func (*Synthetics) GetMonitor ¶
func (s *Synthetics) GetMonitor(monitorID string) (*Monitor, error)
GetMonitor is used to retrieve a specific New Relic Synthetics monitor.
func (*Synthetics) GetMonitorLocations
deprecated
added in
v0.32.0
func (s *Synthetics) GetMonitorLocations() ([]*MonitorLocation, error)
Deprecated: Use entities.GetEntitySearch instead. GetMonitorLocations is used to retrieve all valid locations for Synthetics monitors.
func (*Synthetics) GetMonitorLocationsWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) GetMonitorLocationsWithContext(ctx context.Context) ([]*MonitorLocation, error)
Deprecated: Use entities.GetEntitySearchWithContext instead. GetMonitorLocationsWithContext is used to retrieve all valid locations for Synthetics monitors.
func (*Synthetics) GetMonitorScript ¶
func (s *Synthetics) GetMonitorScript(monitorID string) (*MonitorScript, error)
GetMonitorScript is used to retrieve the script that belongs to a New Relic Synthetics scripted monitor.
func (*Synthetics) GetMonitorScriptWithContext ¶ added in v0.60.0
func (s *Synthetics) GetMonitorScriptWithContext(ctx context.Context, monitorID string) (*MonitorScript, error)
GetMonitorScriptWithContext is used to retrieve the script that belongs to a New Relic Synthetics scripted monitor.
func (*Synthetics) GetMonitorWithContext ¶ added in v0.60.0
GetMonitorWithContext is used to retrieve a specific New Relic Synthetics monitor.
func (*Synthetics) GetSecureCredential
deprecated
added in
v0.10.0
func (s *Synthetics) GetSecureCredential(key string) (*SecureCredential, error)
Deprecated: Use entities.GetEntitySearch instead.
func (*Synthetics) GetSecureCredentialWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) GetSecureCredentialWithContext(ctx context.Context, key string) (*SecureCredential, error)
Deprecated: Use entities.GetEntitySearchWithContext instead.
func (*Synthetics) GetSecureCredentials
deprecated
added in
v0.10.0
func (s *Synthetics) GetSecureCredentials() ([]*SecureCredential, error)
Deprecated: Use entities.GetEntitySearch instead.
func (*Synthetics) GetSecureCredentialsWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) GetSecureCredentialsWithContext(ctx context.Context) ([]*SecureCredential, error)
Deprecated: Use entities.GetEntitySearchWithContext instead.
func (*Synthetics) ListMonitors ¶
func (s *Synthetics) ListMonitors() ([]*Monitor, error)
ListMonitors is used to retrieve New Relic Synthetics monitors.
func (*Synthetics) ListMonitorsWithContext ¶ added in v0.60.0
func (s *Synthetics) ListMonitorsWithContext(ctx context.Context) ([]*Monitor, error)
ListMonitorsWithContext is used to retrieve New Relic Synthetics monitors.
func (*Synthetics) SyntheticsCreatePrivateLocation ¶ added in v0.83.0
func (a *Synthetics) SyntheticsCreatePrivateLocation( accountID int, description string, name string, verifiedScriptExecution bool, ) (*SyntheticsPrivateLocationMutationResult, error)
Create a Synthetics Private Location
func (*Synthetics) SyntheticsCreatePrivateLocationWithContext ¶ added in v0.83.0
func (a *Synthetics) SyntheticsCreatePrivateLocationWithContext( ctx context.Context, accountID int, description string, name string, verifiedScriptExecution bool, ) (*SyntheticsPrivateLocationMutationResult, error)
Create a Synthetics Private Location
func (*Synthetics) SyntheticsCreateSecureCredential ¶ added in v0.79.0
func (a *Synthetics) SyntheticsCreateSecureCredential( accountID int, description string, key string, value SecureValue, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to create a secure credential
func (*Synthetics) SyntheticsCreateSecureCredentialWithContext ¶ added in v0.79.0
func (a *Synthetics) SyntheticsCreateSecureCredentialWithContext( ctx context.Context, accountID int, description string, key string, value SecureValue, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to create a secure credential
func (*Synthetics) SyntheticsDeletePrivateLocation ¶ added in v0.83.0
func (a *Synthetics) SyntheticsDeletePrivateLocation( gUID EntityGUID, ) (*SyntheticsPrivateLocationDeleteResult, error)
Delete a Synthetics Private Location
func (*Synthetics) SyntheticsDeletePrivateLocationWithContext ¶ added in v0.83.0
func (a *Synthetics) SyntheticsDeletePrivateLocationWithContext( ctx context.Context, gUID EntityGUID, ) (*SyntheticsPrivateLocationDeleteResult, error)
Delete a Synthetics Private Location
func (*Synthetics) SyntheticsDeleteSecureCredential ¶ added in v0.79.0
func (a *Synthetics) SyntheticsDeleteSecureCredential( accountID int, key string, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to delete an existing secure credential
func (*Synthetics) SyntheticsDeleteSecureCredentialWithContext ¶ added in v0.79.0
func (a *Synthetics) SyntheticsDeleteSecureCredentialWithContext( ctx context.Context, accountID int, key string, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to delete an existing secure credential
func (*Synthetics) SyntheticsPurgePrivateLocationQueue ¶ added in v0.83.0
func (a *Synthetics) SyntheticsPurgePrivateLocationQueue( gUID EntityGUID, ) (*SyntheticsPrivateLocationPurgeQueueResult, error)
Purge the job queue for a specified private location
func (*Synthetics) SyntheticsPurgePrivateLocationQueueWithContext ¶ added in v0.83.0
func (a *Synthetics) SyntheticsPurgePrivateLocationQueueWithContext( ctx context.Context, gUID EntityGUID, ) (*SyntheticsPrivateLocationPurgeQueueResult, error)
Purge the job queue for a specified private location
func (*Synthetics) SyntheticsUpdatePrivateLocation ¶ added in v0.83.0
func (a *Synthetics) SyntheticsUpdatePrivateLocation( description string, gUID EntityGUID, verifiedScriptExecution bool, ) (*SyntheticsPrivateLocationMutationResult, error)
Update a Synthetics Private Location
func (*Synthetics) SyntheticsUpdatePrivateLocationWithContext ¶ added in v0.83.0
func (a *Synthetics) SyntheticsUpdatePrivateLocationWithContext( ctx context.Context, description string, gUID EntityGUID, verifiedScriptExecution bool, ) (*SyntheticsPrivateLocationMutationResult, error)
Update a Synthetics Private Location
func (*Synthetics) SyntheticsUpdateSecureCredential ¶ added in v0.79.0
func (a *Synthetics) SyntheticsUpdateSecureCredential( accountID int, description string, key string, value SecureValue, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to update an existing secure credential
func (*Synthetics) SyntheticsUpdateSecureCredentialWithContext ¶ added in v0.79.0
func (a *Synthetics) SyntheticsUpdateSecureCredentialWithContext( ctx context.Context, accountID int, description string, key string, value SecureValue, ) (*SyntheticsSecureCredentialMutationResult, error)
Queues a request to update an existing secure credential
func (*Synthetics) UpdateMonitor ¶
func (s *Synthetics) UpdateMonitor(monitor Monitor) (*Monitor, error)
UpdateMonitor is used to update a New Relic Synthetics monitor.
func (*Synthetics) UpdateMonitorScript ¶
func (s *Synthetics) UpdateMonitorScript(monitorID string, script MonitorScript) (*MonitorScript, error)
UpdateMonitorScript is used to add a script to an existing New Relic Synthetics monitor_script.
func (*Synthetics) UpdateMonitorScriptWithContext ¶ added in v0.60.0
func (s *Synthetics) UpdateMonitorScriptWithContext(ctx context.Context, monitorID string, script MonitorScript) (*MonitorScript, error)
UpdateMonitorScriptWithContext is used to add a script to an existing New Relic Synthetics monitor_script.
func (*Synthetics) UpdateMonitorWithContext ¶ added in v0.60.0
func (s *Synthetics) UpdateMonitorWithContext(ctx context.Context, monitor Monitor) (*Monitor, error)
UpdateMonitorWithContext is used to update a New Relic Synthetics monitor.
func (*Synthetics) UpdateSecureCredential
deprecated
added in
v0.10.0
func (s *Synthetics) UpdateSecureCredential(key, value, description string) (*SecureCredential, error)
Deprecated: Use synthetics.SyntheticsUpdateSecureCredential instead
func (*Synthetics) UpdateSecureCredentialWithContext
deprecated
added in
v0.60.0
func (s *Synthetics) UpdateSecureCredentialWithContext(ctx context.Context, key, value, description string) (*SecureCredential, error)
Deprecated: Use synthetics.SyntheticsUpdateSecureCredentialWithContext instead
type SyntheticsCreatePrivateLocationQueryResponse ¶ added in v0.83.0
type SyntheticsCreatePrivateLocationQueryResponse struct {
SyntheticsPrivateLocationMutationResult SyntheticsPrivateLocationMutationResult `json:"SyntheticsCreatePrivateLocation"`
}
type SyntheticsCreateSecureCredentialQueryResponse ¶ added in v0.79.0
type SyntheticsCreateSecureCredentialQueryResponse struct {
SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsCreateSecureCredential"`
}
type SyntheticsDeletePrivateLocationQueryResponse ¶ added in v0.83.0
type SyntheticsDeletePrivateLocationQueryResponse struct {
SyntheticsPrivateLocationDeleteResult SyntheticsPrivateLocationDeleteResult `json:"SyntheticsDeletePrivateLocation"`
}
type SyntheticsDeleteSecureCredentialQueryResponse ¶ added in v0.79.0
type SyntheticsDeleteSecureCredentialQueryResponse struct {
SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsDeleteSecureCredential"`
}
type SyntheticsError ¶ added in v0.79.0
type SyntheticsError struct { // Description explaining the cause of the error Description string `json:"description,omitempty"` }
SyntheticsError - Error object for Synthetics mutations
type SyntheticsPrivateLocationDeleteResult ¶ added in v0.83.0
type SyntheticsPrivateLocationDeleteResult struct { // An array container errors resulting from the mutation, if any Errors []SyntheticsPrivateLocationMutationError `json:"errors,omitempty"` }
SyntheticsPrivateLocationDeleteResult - An array containing errors from the deletion of a private location, if any
type SyntheticsPrivateLocationMutationError ¶ added in v0.83.0
type SyntheticsPrivateLocationMutationError struct { // String description of error Description string `json:"description"` // Enum type of error response Type SyntheticsPrivateLocationMutationErrorType `json:"type"` }
SyntheticsPrivateLocationMutationError - Error object for Synthetic Private Location mutation request
type SyntheticsPrivateLocationMutationErrorType ¶ added in v0.83.0
type SyntheticsPrivateLocationMutationErrorType string
SyntheticsPrivateLocationMutationErrorType - Types of errors that can be returned from a Private Location mutation request
type SyntheticsPrivateLocationMutationResult ¶ added in v0.83.0
type SyntheticsPrivateLocationMutationResult struct { // The account associated to the private location AccountID int `json:"accountId,omitempty"` // A description of the private location Description string `json:"description,omitempty"` // The private location globally unique identifier DomainId string `json:"domainId,omitempty"` // An array container errors resulting from the mutation, if any Errors []SyntheticsPrivateLocationMutationError `json:"errors,omitempty"` // The unique client identifier for the Synthetics private location in New Relic GUID EntityGUID `json:"guid,omitempty"` // The private locations key Key string `json:"key,omitempty"` // An alternate identifier based on name LocationId string `json:"locationId,omitempty"` // The name of the private location Name string `json:"name,omitempty"` // Specifies whether the private location requires a password for scripted monitors VerifiedScriptExecution bool `json:"verifiedScriptExecution,omitempty"` }
SyntheticsPrivateLocationMutationResult - Result of a private location mutation
type SyntheticsPrivateLocationPurgeQueueResult ¶ added in v0.83.0
type SyntheticsPrivateLocationPurgeQueueResult struct { // An array containing errors resulting from the mutation, if any Errors []SyntheticsPrivateLocationMutationError `json:"errors,omitempty"` }
SyntheticsPrivateLocationPurgeQueueResult - Result of a Synthetics purge private location queue mutation
type SyntheticsPurgePrivateLocationQueueQueryResponse ¶ added in v0.83.0
type SyntheticsPurgePrivateLocationQueueQueryResponse struct {
SyntheticsPrivateLocationPurgeQueueResult SyntheticsPrivateLocationPurgeQueueResult `json:"SyntheticsPurgePrivateLocationQueue"`
}
type SyntheticsSecureCredentialMutationResult ¶ added in v0.79.0
type SyntheticsSecureCredentialMutationResult struct { // The moment when the secure credential was created, represented in milliseconds since the Unix epoch. CreatedAt nrtime.EpochMilliseconds `json:"createdAt,omitempty"` // Description of the secure credential, if available Description string `json:"description,omitempty"` // An array containing errors, if any Errors []SyntheticsError `json:"errors,omitempty"` // The unique identifier of the secure credential, if available Key string `json:"key,omitempty"` // The moment when the secure credential was last updated, represented in milliseconds since the Unix epoch. LastUpdate nrtime.EpochMilliseconds `json:"lastUpdate,omitempty"` }
SyntheticsSecureCredentialMutationResult - The result of a secure credential mutation
type SyntheticsUpdatePrivateLocationQueryResponse ¶ added in v0.83.0
type SyntheticsUpdatePrivateLocationQueryResponse struct {
SyntheticsPrivateLocationMutationResult SyntheticsPrivateLocationMutationResult `json:"SyntheticsUpdatePrivateLocation"`
}
type SyntheticsUpdateSecureCredentialQueryResponse ¶ added in v0.79.0
type SyntheticsUpdateSecureCredentialQueryResponse struct {
SyntheticsSecureCredentialMutationResult SyntheticsSecureCredentialMutationResult `json:"SyntheticsUpdateSecureCredential"`
}
type Time ¶
Time is a type used for unmarshaling timestamps generated by the Synthetics API. Its underlying type is time.Time.
func (Time) MarshalJSON ¶
MarshalJSON is responsible for marshaling the Time type.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON is responsible for unmarshaling the Time type.