protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	VUnsupported = Version(0)
	V1           = Version(1)
)

Command request versions:

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdRequestDiscriminator

type CmdRequestDiscriminator struct {
	CommandRequestVersion string `json:"command_request_version"`
}

CmdRequestDiscriminator represents the JSON shape for an integration command request.

type CmdRequestV1

type CmdRequestV1 struct {
	CmdRequestDiscriminator
	Commands []CmdRequestV1Cmd `json:"commands"`
}

CmdRequestV1 carries an integration payload requesting command/s execution. This applies to a command request v1. Payload comes from JSON decoding. Expected shape is:

{
  "command_request_version": "1",
  "commands": [
    {
      "name": "foo":,
      "command": "/foo",
      "args": ["-bar", "baz"],
      "env": {
        "FOO": "BAR",
      }
    }
  ]
}

func DeserializeLine

func DeserializeLine(line []byte) (r CmdRequestV1, err error)

type CmdRequestV1Cmd

type CmdRequestV1Cmd struct {
	Name    string            `json:"name"`
	Command string            `json:"command"`
	Args    []string          `json:"args"`
	Env     map[string]string `json:"env"`
}

type Version

type Version int

func IsCommandRequest

func IsCommandRequest(line []byte) (isCmdRequest bool, cmdRequestVersion Version)

IsCommandRequest guesses whether a json line (coming through a previous integration response) belongs to command request payload, providing which version it belongs to in case it succeed.

Jump to

Keyboard shortcuts

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