Documentation ¶
Overview ¶
* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2017-2018 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- func GetArg(cmd *cobra.Command, arg string) (string, error)
- func GetNewRelicClient(ctype ...string) (*newrelic.Client, error)
- func GuessJSONStream(r io.Reader, size int) (io.Reader, []byte, bool)
- func MergeAlertChannelList(s1 []*newrelic.AlertsChannel, s2 []*newrelic.AlertsChannel) (slice []*newrelic.AlertsChannel)
- func MergeAlertConditionList(s1 *newrelic.AlertsConditionList, s2 *newrelic.AlertsConditionList) *newrelic.AlertsConditionList
- func MergeAlertDefaultConditionsList(s1 []*newrelic.AlertsDefaultCondition, s2 []*newrelic.AlertsDefaultCondition) (slice []*newrelic.AlertsDefaultCondition)
- func MergeAlertExternalServiceConditionsList(s1 []*newrelic.AlertsExternalServiceCondition, ...) (slice []*newrelic.AlertsExternalServiceCondition)
- func MergeAlertNRQLConditionsList(s1 []*newrelic.AlertsNRQLCondition, s2 []*newrelic.AlertsNRQLCondition) (slice []*newrelic.AlertsNRQLCondition)
- func MergeAlertPluginsConditionsList(s1 []*newrelic.AlertsPluginsCondition, s2 []*newrelic.AlertsPluginsCondition) (slice []*newrelic.AlertsPluginsCondition)
- func MergeAlertPolicyList(s1 []*newrelic.AlertsPolicy, s2 []*newrelic.AlertsPolicy) (slice []*newrelic.AlertsPolicy)
- func MergeAlertSyntheticsConditionsList(s1 []*newrelic.AlertsSyntheticsCondition, ...) (slice []*newrelic.AlertsSyntheticsCondition)
- func MergeLabelList(s1 []*newrelic.Label, s2 []*newrelic.Label) (slice []*newrelic.Label)
- func MergeMonitorList(s1 []*newrelic.Monitor, s2 []*newrelic.Monitor) (slice []*newrelic.Monitor)
- func MergeMonitorReflList(s1 []*newrelic.MonitorRef, s2 []*newrelic.MonitorRef) (slice []*newrelic.MonitorRef)
- func MergeStringList(s1 []*string, s2 []*string) (slice []*string)
- func NewDocumentDecoder(r io.ReadCloser) io.ReadCloser
- func ToJSON(data []byte) ([]byte, error)
- type JSONPrinter
- type JSONSyntaxError
- type LineReader
- type Printer
- type Reader
- type TablePrinter
- type YAMLDecoder
- type YAMLOrJSONDecoder
- type YAMLPrinter
- type YAMLReader
- type YAMLSyntaxError
- type YAMLToJSONDecoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNewRelicClient ¶
GetNewRelicClient returns a NewRelicClient, if env var NEW_RELIC_APIKEY is set
func GuessJSONStream ¶
GuessJSONStream scans the provided reader up to size, looking for an open brace indicating this is JSON. It will return the bufio.Reader it creates for the consumer.
func MergeAlertChannelList ¶
func MergeAlertChannelList(s1 []*newrelic.AlertsChannel, s2 []*newrelic.AlertsChannel) (slice []*newrelic.AlertsChannel)
func MergeAlertConditionList ¶
func MergeAlertConditionList(s1 *newrelic.AlertsConditionList, s2 *newrelic.AlertsConditionList) *newrelic.AlertsConditionList
func MergeAlertDefaultConditionsList ¶
func MergeAlertDefaultConditionsList(s1 []*newrelic.AlertsDefaultCondition, s2 []*newrelic.AlertsDefaultCondition) (slice []*newrelic.AlertsDefaultCondition)
func MergeAlertExternalServiceConditionsList ¶
func MergeAlertExternalServiceConditionsList(s1 []*newrelic.AlertsExternalServiceCondition, s2 []*newrelic.AlertsExternalServiceCondition) (slice []*newrelic.AlertsExternalServiceCondition)
func MergeAlertNRQLConditionsList ¶
func MergeAlertNRQLConditionsList(s1 []*newrelic.AlertsNRQLCondition, s2 []*newrelic.AlertsNRQLCondition) (slice []*newrelic.AlertsNRQLCondition)
func MergeAlertPluginsConditionsList ¶
func MergeAlertPluginsConditionsList(s1 []*newrelic.AlertsPluginsCondition, s2 []*newrelic.AlertsPluginsCondition) (slice []*newrelic.AlertsPluginsCondition)
func MergeAlertPolicyList ¶
func MergeAlertPolicyList(s1 []*newrelic.AlertsPolicy, s2 []*newrelic.AlertsPolicy) (slice []*newrelic.AlertsPolicy)
func MergeAlertSyntheticsConditionsList ¶
func MergeAlertSyntheticsConditionsList(s1 []*newrelic.AlertsSyntheticsCondition, s2 []*newrelic.AlertsSyntheticsCondition) (slice []*newrelic.AlertsSyntheticsCondition)
func MergeLabelList ¶
func MergeMonitorList ¶
func MergeMonitorReflList ¶
func MergeMonitorReflList(s1 []*newrelic.MonitorRef, s2 []*newrelic.MonitorRef) (slice []*newrelic.MonitorRef)
func MergeStringList ¶
func NewDocumentDecoder ¶
func NewDocumentDecoder(r io.ReadCloser) io.ReadCloser
NewDocumentDecoder decodes YAML documents from the provided stream in chunks by converting each document (as defined by the YAML spec) into its own chunk. io.ErrShortBuffer will be returned if the entire buffer could not be read to assist the caller in framing the chunk.
Types ¶
type JSONPrinter ¶
type JSONPrinter struct{}
func (*JSONPrinter) Print ¶
func (p *JSONPrinter) Print(obj interface{}, out io.Writer)
type JSONSyntaxError ¶
func (JSONSyntaxError) Error ¶
func (e JSONSyntaxError) Error() string
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
func (*LineReader) Read ¶
func (r *LineReader) Read() ([]byte, error)
Read returns a single line (with '\n' ended) from the underlying reader. An error is returned iff there is an error with the underlying reader.
type TablePrinter ¶
type TablePrinter struct{}
func (*TablePrinter) Print ¶
func (p *TablePrinter) Print(obj interface{}, out io.Writer)
type YAMLDecoder ¶
type YAMLDecoder struct {
// contains filtered or unexported fields
}
YAMLDecoder reads chunks of objects and returns ErrShortBuffer if the data is not sufficient.
func (*YAMLDecoder) Close ¶
func (d *YAMLDecoder) Close() error
type YAMLOrJSONDecoder ¶
type YAMLOrJSONDecoder struct {
// contains filtered or unexported fields
}
YAMLOrJSONDecoder attempts to decode a stream of JSON documents or YAML documents by sniffing for a leading { character.
func NewYAMLOrJSONDecoder ¶
func NewYAMLOrJSONDecoder(r io.Reader, bufferSize int) *YAMLOrJSONDecoder
NewYAMLOrJSONDecoder returns a decoder that will process YAML documents or JSON documents from the given reader as a stream. bufferSize determines how far into the stream the decoder will look to figure out whether this is a JSON stream (has whitespace followed by an open brace).
func (*YAMLOrJSONDecoder) Decode ¶
func (d *YAMLOrJSONDecoder) Decode(into interface{}) error
Decode unmarshals the next object from the underlying stream into the provide object, or returns an error.
type YAMLPrinter ¶
type YAMLPrinter struct{}
func (*YAMLPrinter) Print ¶
func (p *YAMLPrinter) Print(obj interface{}, out io.Writer)
type YAMLReader ¶
type YAMLReader struct {
// contains filtered or unexported fields
}
func NewYAMLReader ¶
func NewYAMLReader(r *bufio.Reader) *YAMLReader
func (*YAMLReader) Read ¶
func (r *YAMLReader) Read() ([]byte, error)
Read returns a full YAML document.
type YAMLSyntaxError ¶
type YAMLSyntaxError struct {
// contains filtered or unexported fields
}
func (YAMLSyntaxError) Error ¶
func (e YAMLSyntaxError) Error() string
type YAMLToJSONDecoder ¶
type YAMLToJSONDecoder struct {
// contains filtered or unexported fields
}
YAMLToJSONDecoder decodes YAML documents from an io.Reader by separating individual documents. It first converts the YAML body to JSON, then unmarshals the JSON.
func NewYAMLToJSONDecoder ¶
func NewYAMLToJSONDecoder(r io.Reader) *YAMLToJSONDecoder
NewYAMLToJSONDecoder decodes YAML documents from the provided stream in chunks by converting each document (as defined by the YAML spec) into its own chunk, converting it to JSON via yaml.YAMLToJSON, and then passing it to json.Decoder.
func (*YAMLToJSONDecoder) Decode ¶
func (d *YAMLToJSONDecoder) Decode(into interface{}) error
Decode reads a YAML document as JSON from the stream or returns an error. The decoding rules match json.Unmarshal, not yaml.Unmarshal.