github.com/newrelic/newrelic-client-go@v1.1.0/pkg/edge/types.go (about)

     1  // Code generated by tutone: DO NOT EDIT
     2  package edge
     3  
     4  import (
     5  	"encoding/json"
     6  	"fmt"
     7  )
     8  
     9  // EdgeCreateTraceObserverResponseErrorType - Known error codes and messages for `CreateTraceObserverResponseError`.
    10  type EdgeCreateTraceObserverResponseErrorType string
    11  
    12  var EdgeCreateTraceObserverResponseErrorTypeTypes = struct {
    13  	// A trace observer already exists for this account family and provider region.
    14  	ALREADY_EXISTS EdgeCreateTraceObserverResponseErrorType
    15  	// Trace observers aren’t available in provider region.
    16  	NO_AVAILABILITY_IN_REGION EdgeCreateTraceObserverResponseErrorType
    17  }{
    18  	// A trace observer already exists for this account family and provider region.
    19  	ALREADY_EXISTS: "ALREADY_EXISTS",
    20  	// Trace observers aren’t available in provider region.
    21  	NO_AVAILABILITY_IN_REGION: "NO_AVAILABILITY_IN_REGION",
    22  }
    23  
    24  // EdgeDeleteTraceObserverResponseErrorType - Known error codes and messages for `DeleteTraceObserverResponseError`.
    25  type EdgeDeleteTraceObserverResponseErrorType string
    26  
    27  var EdgeDeleteTraceObserverResponseErrorTypeTypes = struct {
    28  	// The trace observer has already been deleted.
    29  	ALREADY_DELETED EdgeDeleteTraceObserverResponseErrorType
    30  	// No trace observer was found with the id given.
    31  	NOT_FOUND EdgeDeleteTraceObserverResponseErrorType
    32  }{
    33  	// The trace observer has already been deleted.
    34  	ALREADY_DELETED: "ALREADY_DELETED",
    35  	// No trace observer was found with the id given.
    36  	NOT_FOUND: "NOT_FOUND",
    37  }
    38  
    39  // EdgeEndpointStatus - Status of the endpoint.
    40  type EdgeEndpointStatus string
    41  
    42  var EdgeEndpointStatusTypes = struct {
    43  	// The endpoint has been created and is available for use.
    44  	CREATED EdgeEndpointStatus
    45  	// The endpoint has been deleted and is no longer available for use.
    46  	DELETED EdgeEndpointStatus
    47  }{
    48  	// The endpoint has been created and is available for use.
    49  	CREATED: "CREATED",
    50  	// The endpoint has been deleted and is no longer available for use.
    51  	DELETED: "DELETED",
    52  }
    53  
    54  // EdgeEndpointType - Type of connection established with the trace observer. Currently, only `PUBLIC` is supported.
    55  type EdgeEndpointType string
    56  
    57  var EdgeEndpointTypeTypes = struct {
    58  	// PUBLIC: the endpoint is reachable on the internet.
    59  	PUBLIC EdgeEndpointType
    60  }{
    61  	// PUBLIC: the endpoint is reachable on the internet.
    62  	PUBLIC: "PUBLIC",
    63  }
    64  
    65  // EdgeProviderRegion - Provider and region where the trace observer is located. Currently, only AWS regions are supported.
    66  type EdgeProviderRegion string
    67  
    68  var EdgeProviderRegionTypes = struct {
    69  	// Provider: `AWS`, Region: `eu-west-1`
    70  	AWS_EU_WEST_1 EdgeProviderRegion
    71  	// Provider: `AWS`, Region: `us-east-1`
    72  	AWS_US_EAST_1 EdgeProviderRegion
    73  	// Provider: `AWS`, Region: `us-east-2`
    74  	AWS_US_EAST_2 EdgeProviderRegion
    75  	// Provider: `AWS`, Region: `us-west-2`
    76  	AWS_US_WEST_2 EdgeProviderRegion
    77  }{
    78  	// Provider: `AWS`, Region: `eu-west-1`
    79  	AWS_EU_WEST_1: "AWS_EU_WEST_1",
    80  	// Provider: `AWS`, Region: `us-east-1`
    81  	AWS_US_EAST_1: "AWS_US_EAST_1",
    82  	// Provider: `AWS`, Region: `us-east-2`
    83  	AWS_US_EAST_2: "AWS_US_EAST_2",
    84  	// Provider: `AWS`, Region: `us-west-2`
    85  	AWS_US_WEST_2: "AWS_US_WEST_2",
    86  }
    87  
    88  // EdgeSpanAttributeKeyOperator - Span attribute key operator types
    89  type EdgeSpanAttributeKeyOperator string
    90  
    91  var EdgeSpanAttributeKeyOperatorTypes = struct {
    92  	// Matches on an exact value
    93  	EQUALS EdgeSpanAttributeKeyOperator
    94  	// Matches on a value that starts-with and/or ends-with the provided value
    95  	LIKE EdgeSpanAttributeKeyOperator
    96  }{
    97  	// Matches on an exact value
    98  	EQUALS: "EQUALS",
    99  	// Matches on a value that starts-with and/or ends-with the provided value
   100  	LIKE: "LIKE",
   101  }
   102  
   103  // EdgeSpanAttributeValueOperator - Span attribute value operator types
   104  type EdgeSpanAttributeValueOperator string
   105  
   106  var EdgeSpanAttributeValueOperatorTypes = struct {
   107  	// Matches on an exact value
   108  	EQUALS EdgeSpanAttributeValueOperator
   109  	// Matches on any value
   110  	IS_NOT_NULL EdgeSpanAttributeValueOperator
   111  	// Matches on a value that starts-with and/or ends-with the provided value
   112  	LIKE EdgeSpanAttributeValueOperator
   113  }{
   114  	// Matches on an exact value
   115  	EQUALS: "EQUALS",
   116  	// Matches on any value
   117  	IS_NOT_NULL: "IS_NOT_NULL",
   118  	// Matches on a value that starts-with and/or ends-with the provided value
   119  	LIKE: "LIKE",
   120  }
   121  
   122  // EdgeTraceFilterAction - Type of action to perform when a `TraceFilter` match occurs
   123  type EdgeTraceFilterAction string
   124  
   125  var EdgeTraceFilterActionTypes = struct {
   126  	// Discards traces that match the filter
   127  	DISCARD EdgeTraceFilterAction
   128  	// Keeps traces that match the filter
   129  	KEEP EdgeTraceFilterAction
   130  }{
   131  	// Discards traces that match the filter
   132  	DISCARD: "DISCARD",
   133  	// Keeps traces that match the filter
   134  	KEEP: "KEEP",
   135  }
   136  
   137  // EdgeTraceObserverStatus - Status of the trace observer.
   138  type EdgeTraceObserverStatus string
   139  
   140  var EdgeTraceObserverStatusTypes = struct {
   141  	// The trace observer has been created and is available for use.
   142  	CREATED EdgeTraceObserverStatus
   143  	// The trace observer has been deleted and is no longer available for use.
   144  	DELETED EdgeTraceObserverStatus
   145  }{
   146  	// The trace observer has been created and is available for use.
   147  	CREATED: "CREATED",
   148  	// The trace observer has been deleted and is no longer available for use.
   149  	DELETED: "DELETED",
   150  }
   151  
   152  // EdgeAccountStitchedFields -
   153  type EdgeAccountStitchedFields struct {
   154  	// Provides access to Tracing data.
   155  	Tracing EdgeTracing `json:"tracing,omitempty"`
   156  }
   157  
   158  // EdgeAgentEndpointDetail - All the details necessary to configure an agent to connect to an endoint.
   159  type EdgeAgentEndpointDetail struct {
   160  	// Full host name that is used to connect to the endpoint. This is the part that will be placed into an agent config named `infinite_tracing.trace_observer.host`.
   161  	Host string `json:"host"`
   162  	// Port that is used to connect to the endpoint. This is the part that will be placed into an agent config named `infinite_tracing.trace_observer.port`.
   163  	Port int `json:"port"`
   164  }
   165  
   166  func (x *EdgeAgentEndpointDetail) ImplementsEdgeEndpointDetail() {}
   167  
   168  // EdgeCreateTraceObserverInput - Data required to create a trace observer.
   169  type EdgeCreateTraceObserverInput struct {
   170  	// When set to `true` a trace observer will write trace metrics to the current account.
   171  	Monitoring bool `json:"monitoring,omitempty"`
   172  	// Name of the trace observer.
   173  	Name string `json:"name"`
   174  	// Provider and region where the trace observer must run. Currently, only AWS regions are supported.
   175  	ProviderRegion EdgeProviderRegion `json:"providerRegion"`
   176  }
   177  
   178  // EdgeCreateTraceObserverResponse - Successfully created trace observers, or one or more error responses if there were issues.
   179  type EdgeCreateTraceObserverResponse struct {
   180  	// Errors that may occur when creating a `TraceObserver`. Defaults to `null` in case of success.
   181  	Errors []EdgeCreateTraceObserverResponseError `json:"errors,omitempty"`
   182  	// The trace observer defined in `CreateTraceObserverInput`. Defaults to `null` in case of failure.
   183  	TraceObserver EdgeTraceObserver `json:"traceObserver,omitempty"`
   184  }
   185  
   186  // EdgeCreateTraceObserverResponseError - Description of errors that may occur while attempting to create a trace observer.
   187  type EdgeCreateTraceObserverResponseError struct {
   188  	// Error message, with further detail to help resolve the issue.
   189  	Message string `json:"message"`
   190  	// Error that may occur while attempting to create a trace observer.
   191  	Type EdgeCreateTraceObserverResponseErrorType `json:"type"`
   192  }
   193  
   194  // EdgeCreateTraceObserverResponses - Array of responses, one for each trace observer creation request.
   195  type EdgeCreateTraceObserverResponses struct {
   196  	// Array of trace observer creation responses, one for each `CreateTraceObserverInput`.
   197  	Responses []EdgeCreateTraceObserverResponse `json:"responses"`
   198  }
   199  
   200  // EdgeDeleteTraceObserverInput - Data required to delete a trace observer.
   201  type EdgeDeleteTraceObserverInput struct {
   202  	// Globally unique identifier of the trace observer being deleted.
   203  	ID int `json:"id"`
   204  }
   205  
   206  // EdgeDeleteTraceObserverResponse - Successfully deleted trace observers, or one or more error responses if there were issues.
   207  type EdgeDeleteTraceObserverResponse struct {
   208  	// Errors that may occur when deleting a `TraceObserver`. Defaults to `null` in case of success.
   209  	Errors []EdgeDeleteTraceObserverResponseError `json:"errors,omitempty"`
   210  	// The trace observer that was deleted. Defaults to `null` in case of failure.
   211  	TraceObserver EdgeTraceObserver `json:"traceObserver,omitempty"`
   212  }
   213  
   214  // EdgeDeleteTraceObserverResponseError - Description of errors that may occur while attempting to delete a trace observer.
   215  type EdgeDeleteTraceObserverResponseError struct {
   216  	// Error message, with further detail to help resolve the issue.
   217  	Message string `json:"message"`
   218  	// Error that may occur while attempting to delete a trace observer.
   219  	Type EdgeDeleteTraceObserverResponseErrorType `json:"type"`
   220  }
   221  
   222  // EdgeDeleteTraceObserverResponses - Array of responses, one for each trace observer deletion request.
   223  type EdgeDeleteTraceObserverResponses struct {
   224  	// Array of trace observer deletion responses, one for each `DeleteTraceObserverInput`.
   225  	Responses []EdgeDeleteTraceObserverResponse `json:"responses"`
   226  }
   227  
   228  // EdgeEndpoint - An `Endpoint` describes access to an endpoint pointing to a trace observer. Currently, only one endpoint per trace observer is supported.
   229  type EdgeEndpoint struct {
   230  	// Connection information related to the agent configuration.
   231  	Agent EdgeAgentEndpointDetail `json:"agent"`
   232  	// Type of the endpoint.
   233  	EndpointType EdgeEndpointType `json:"endpointType"`
   234  	// Connection information related to the Infinite Tracing Trace API (HTTP 1.1) configuration.
   235  	Https EdgeHttpsEndpointDetail `json:"https"`
   236  	// Status of the endpoint.
   237  	Status EdgeEndpointStatus `json:"status"`
   238  }
   239  
   240  // EdgeEndpointDetail - The information common to all endpoints.
   241  type EdgeEndpointDetail struct {
   242  	// Full host name that is used to connect to the endpoint.
   243  	Host string `json:"host"`
   244  	// Port that is used to connect to the endpoint.
   245  	Port int `json:"port"`
   246  }
   247  
   248  func (x *EdgeEndpointDetail) ImplementsEdgeEndpointDetail() {}
   249  
   250  // EdgeHttpsEndpointDetail - All the details necessary to configure an integration to connect to the Infinite Tracing Trace API (HTTP 1.1) endpoint.
   251  type EdgeHttpsEndpointDetail struct {
   252  	// Full host name that is used to connect to the endpoint.
   253  	Host string `json:"host"`
   254  	// Port that is used to connect to the endpoint.
   255  	Port int `json:"port"`
   256  	// Full URL used to send data to the endpoint. For instance, if you were using the
   257  	//  [Java Telemetry SDK](https://docs.newrelic.com/docs/data-ingest-apis/get-data-new-relic/new-relic-sdks/telemetry-sdks-send-custom-telemetry-data-new-relic)
   258  	//  this is the data you would use to create a `URI` to pass to the [`uriOverride`](https://github.com/newrelic/newrelic-telemetry-sdk-java/blob/85e526cf6fbba0640f20d2d7a3ab0dab89f958b3/telemetry_core/src/main/java/com/newrelic/telemetry/AbstractSenderBuilder.java#L37-L48)
   259  	//  method.
   260  	URL string `json:"url"`
   261  }
   262  
   263  func (x *EdgeHttpsEndpointDetail) ImplementsEdgeEndpointDetail() {}
   264  
   265  // EdgeRandomTraceFilter - Contains all of the data that is used to sample traces based on random selection.
   266  type EdgeRandomTraceFilter struct {
   267  	// The percent of traces to keep when selected at random.
   268  	PercentKept float64 `json:"percentKept"`
   269  }
   270  
   271  // EdgeSpanAttributeRule - A `SpanAttributeRule` applies a filtering rule (keep or discard) to traces within a particular `TraceObserver`
   272  type EdgeSpanAttributeRule struct {
   273  	// The action that this filter takes if it matches the provided attribute name and value
   274  	Action EdgeTraceFilterAction `json:"action"`
   275  	// Globally unique identifier of this trace filter.
   276  	ID int `json:"id"`
   277  	// Name of the attribute that this filter matches on
   278  	Key string `json:"key"`
   279  	// Type of match to apply to the attribute name (EQUALS, LIKE).
   280  	KeyOperator EdgeSpanAttributeKeyOperator `json:"keyOperator"`
   281  	// Value of the attribute that this filter matches on.
   282  	Value string `json:"value,omitempty"`
   283  	// Type of match to apply to the attribute value (EQUALS, LIKE, IS_NOT_NULL).
   284  	ValueOperator EdgeSpanAttributeValueOperator `json:"valueOperator"`
   285  }
   286  
   287  // EdgeSpanAttributesTraceFilter - Contains all of the data that is used to sample traces based on their attributes.
   288  type EdgeSpanAttributesTraceFilter struct {
   289  	// The list of rules that determine whether to keep or drop a trace based on a span attribute.
   290  	SpanAttributeRules []EdgeSpanAttributeRule `json:"spanAttributeRules"`
   291  }
   292  
   293  // EdgeTraceFilters - A container for all trace filter rule types
   294  type EdgeTraceFilters struct {
   295  	// Random trace filter configuration applied to the trace observer.
   296  	RandomTraceFilter EdgeRandomTraceFilter `json:"randomTraceFilter"`
   297  	// Span attribute trace filter configuration applied to the trace observer.
   298  	SpanAttributesTraceFilter EdgeSpanAttributesTraceFilter `json:"spanAttributesTraceFilter"`
   299  }
   300  
   301  // EdgeTraceObserver - `TraceObserver` handles a group of tracing services for an account family.
   302  type EdgeTraceObserver struct {
   303  	// List of endpoints associated with this trace observer. Currently, only one endpoint per trace observer is supported.
   304  	Endpoints []EdgeEndpoint `json:"endpoints"`
   305  	// Globally unique identifier of this trace observer.
   306  	ID int `json:"id"`
   307  	// Which account monitoring metrics are being written to for this trace observer (if specified)
   308  	MonitoringAccountId int `json:"monitoringAccountId,omitempty"`
   309  	// Human-readable name of this trace observer.
   310  	Name string `json:"name"`
   311  	// Provider-specific region of this endpoint (for example, `AWS_US_EAST_1`). Currently, only AWS regions are supported.
   312  	ProviderRegion EdgeProviderRegion `json:"providerRegion"`
   313  	// Status of the trace observer.
   314  	Status EdgeTraceObserverStatus `json:"status"`
   315  	// Trace filters applied to the trace observer.
   316  	TraceFilters EdgeTraceFilters `json:"traceFilters"`
   317  }
   318  
   319  // EdgeTracing - This field provides access to Tracing data.
   320  type EdgeTracing struct {
   321  	// Lists the existing trace observers for this account family.
   322  	TraceObservers []EdgeTraceObserver `json:"traceObservers"`
   323  }
   324  
   325  // Float - The `Float` scalar type represents signed double-precision fractional
   326  // values as specified by
   327  // [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).
   328  type Float string
   329  
   330  // EdgeEndpointDetail - The information common to all endpoints.
   331  type EdgeEndpointDetailInterface interface {
   332  	ImplementsEdgeEndpointDetail()
   333  }
   334  
   335  // UnmarshalEdgeEndpointDetailInterface unmarshals the interface into the correct type
   336  // based on __typename provided by GraphQL
   337  func UnmarshalEdgeEndpointDetailInterface(b []byte) (*EdgeEndpointDetailInterface, error) {
   338  	var err error
   339  
   340  	var rawMessageEdgeEndpointDetail map[string]*json.RawMessage
   341  	err = json.Unmarshal(b, &rawMessageEdgeEndpointDetail)
   342  	if err != nil {
   343  		return nil, err
   344  	}
   345  
   346  	// Nothing to unmarshal
   347  	if len(rawMessageEdgeEndpointDetail) < 1 {
   348  		return nil, nil
   349  	}
   350  
   351  	var typeName string
   352  
   353  	if rawTypeName, ok := rawMessageEdgeEndpointDetail["__typename"]; ok {
   354  		err = json.Unmarshal(*rawTypeName, &typeName)
   355  		if err != nil {
   356  			return nil, err
   357  		}
   358  
   359  		switch typeName {
   360  		case "EdgeAgentEndpointDetail":
   361  			var interfaceType EdgeAgentEndpointDetail
   362  			err = json.Unmarshal(b, &interfaceType)
   363  			if err != nil {
   364  				return nil, err
   365  			}
   366  
   367  			var xxx EdgeEndpointDetailInterface = &interfaceType
   368  
   369  			return &xxx, nil
   370  		case "EdgeHttpsEndpointDetail":
   371  			var interfaceType EdgeHttpsEndpointDetail
   372  			err = json.Unmarshal(b, &interfaceType)
   373  			if err != nil {
   374  				return nil, err
   375  			}
   376  
   377  			var xxx EdgeEndpointDetailInterface = &interfaceType
   378  
   379  			return &xxx, nil
   380  		}
   381  	} else {
   382  		keys := []string{}
   383  		for k := range rawMessageEdgeEndpointDetail {
   384  			keys = append(keys, k)
   385  		}
   386  		return nil, fmt.Errorf("interface EdgeEndpointDetail did not include a __typename field for inspection: %s", keys)
   387  	}
   388  
   389  	return nil, fmt.Errorf("interface EdgeEndpointDetail was not matched against all PossibleTypes: %s", typeName)
   390  }