resource

package module
v0.0.0-...-6b4397c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

discord-notification-resource

A Concourse resource for webhook notifications in Discord. Written in Go.

Example

resource_types:
- name: discord-notification-resource
  type: registry-image
  source:
    repository: logsquaredn/discord-notification-resource
    tag: latest

resources:
- name: notify
  type: discord-notification-resource
  source:
    ...

jobs:
- name: some-job
  plan:
  ...
  - put: notify
    params:
      ...

Source Configuration

Parameter Required Description
webhook_id yes the id of the webhook to post to see below (1)
token yes the token to use to authenticate when posting to the webhook see below (2)

(1) webhook_id will be the second to last path parameter in the url copied from the Copy Webhook URL button below

(2) token will be the last path parameter in the url copied from the Copy Webhook URL button below

webhook-id

Behavior

check

not implemented

in

not implemented

out

see discordgo.WebhookParams. Addtionally:

Parameter Required Description
wait no whether or not to wait on the response and gather version and metadata info from it. Default false
content_file no path to a file containing the content of the message. Overrides content
username_file no path to a file containing the username for the message. Overrides username
avatar_url_file no path to a file containing the url of the avatar for the message. Overrides avatar_url

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Metadata is the object which is passed in array form to Concourse through stdout from /opt/resource/out and /opt/resource/in to provide additional information about the Version

type OutRequest

type OutRequest struct {
	Source Source    `json:"source"`
	Params PutParams `json:"params"`
}

OutRequest is the JSON object that Concourse passes to /opt/resource/out through stdin

type OutResponse

type OutResponse struct {
	Version  Version    `json:"version"`
	Metadata []Metadata `json:"metadata"`
}

OutResponse is the JSON object that we pass back to Concourse through stdout from /opt/resource/out

type PutParams

type PutParams struct {
	discordgo.WebhookParams
	ContentFile   string `json:"content_file,omitempty"`
	UsernameFile  string `json:"username_file,omitempty"`
	AvatarURLFile string `json:"avatar_url_file,omitempty"`
	Wait          bool   `json:"wait,omitempty"`
}

PutParams are additional parameters that can be passed to this Concourse Resource Type during a put step

type Source

type Source struct {
	WebhookID string `json:"webhook_id"`
	Token     string `json:"token"`
}

Source is the JSON (yaml) object configured under the resources array in a Concourse pipeline

type Version

type Version struct {
	Message string `json:"message"`
}

Version is the JSON object that is passed to and from Concourse

Directories

Path Synopsis
cmd
in
out

Jump to

Keyboard shortcuts

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