api

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Copyright © 2021 Yale University

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQueryArrayValues added in v0.28.0

func GetQueryArrayValues(r *http.Request, key string) ([]string, error)

func NewServer

func NewServer(config common.Config) error

NewServer creates a new server and starts it

func NotImplemented

func NotImplemented(w http.ResponseWriter, r *http.Request)

NotImplemented handler is a temporary handler for endpoints not yet implemented

func SnapshotsWithoutCOA added in v0.26.0

func SnapshotsWithoutCOA(ctx context.Context, orch *ec2Orchestrator) ([]*ec2.Snapshot, error)

func TokenMiddleware

func TokenMiddleware(psk []byte, public map[string]string, h http.Handler) http.Handler

TokenMiddleware checks the tokens for non-public URLs

func UpdateSnapshotTags added in v0.26.0

func UpdateSnapshotTags(ctx context.Context, orch *ec2Orchestrator, snaps []*ec2.Snapshot) (map[string][]string, error)

Types

type AssociationDescription added in v0.9.0

type AssociationDescription struct {
	Name                        string              `json:"name"`
	InstanceId                  string              `json:"instance_id"`
	AssociationVersion          string              `json:"association_version"`
	Date                        string              `json:"date"`
	LastUpdateAssociationDate   string              `json:"last_update_association_date"`
	Status                      AssociationStatus   `json:"status"`
	Overview                    AssociationOverview `json:"overview"`
	DocumentVersion             string              `json:"document_version"`
	AssociationId               string              `json:"association_id"`
	Targets                     []AssociationTarget `json:"targets"`
	LastExecutionDate           string              `json:"last_execution_date"`
	LastSuccessfulExecutionDate string              `json:"last_successful_execution_date"`
	ApplyOnlyAtCronInterval     bool                `json:"apply_only_at_cron_interval"`
}

type AssociationOverview added in v0.9.0

type AssociationOverview struct {
	Status         string `json:"status"`
	DetailedStatus string `json:"detailed_status"`
}

type AssociationStatus added in v0.9.0

type AssociationStatus struct {
	Date    string `json:"date"`
	Name    string `json:"name"`
	Message string `json:"message"`
}

type AssociationTarget added in v0.9.0

type AssociationTarget struct {
	Key    string   `json:"key"`
	Values []string `json:"values"`
}

type CloudWatchOutputConfig added in v0.9.0

type CloudWatchOutputConfig struct {
	CloudWatchLogGroupName  string `json:"cloud_watch_log_group_name"`
	CloudWatchOutputEnabled bool   `json:"cloud_watch_output_enabled"`
}

type Ec2BlockDevice added in v0.8.0

type Ec2BlockDevice struct {
	DeviceName *string       `json:"device_name"`
	Ebs        *Ec2EbsVolume `json:"ebs"`
}

type Ec2EbsVolume added in v0.8.0

type Ec2EbsVolume struct {
	Encrypted  *bool   `json:"encrypted"`
	VolumeSize *int64  `json:"volume_size"`
	VolumeType *string `json:"volume_type"`
}

type Ec2ImageCreateRequest added in v0.17.0

type Ec2ImageCreateRequest struct {
	InstanceId  *string `json:"instance_id"`
	Name        *string `json:"name"`
	Description *string `json:"description"`
	CopyTags    *bool   `json:"copy_tags"`
	ForceReboot *bool   `json:"force_reboot"`
}

type Ec2ImageResponse

type Ec2ImageResponse struct {
	Architecture   string              `json:"architecture"`
	CreatedAt      string              `json:"created_at"`
	CreatedBy      string              `json:"created_by"`
	Description    string              `json:"description"`
	ID             string              `json:"id"`
	Name           string              `json:"name"`
	Public         bool                `json:"public"`
	RootDeviceName string              `json:"root_device_name"`
	RootDeviceType string              `json:"root_device_type"`
	State          string              `json:"state"`
	Tags           []map[string]string `json:"tags"`
	Type           string              `json:"type"`
	Volumes        Ec2ImageVolumeMap   `json:"volumes"`
}

type Ec2ImageUpdateRequest added in v0.10.0

type Ec2ImageUpdateRequest struct {
	Tags map[string]string `json:"tags"`
}

type Ec2ImageVolumeMap added in v0.2.0

type Ec2ImageVolumeMap map[string]*Ec2ImageVolumeResponse

func (*Ec2ImageVolumeMap) MarshalJSON added in v0.2.0

func (e *Ec2ImageVolumeMap) MarshalJSON() ([]byte, error)

MarshalJSON for Ec2ImageVolumeMap to return an empty object (`{}`) for nil values (instead of `null`)

type Ec2ImageVolumeResponse

type Ec2ImageVolumeResponse struct {
	DeleteOnTermination bool   `json:"delete_on_termination"`
	SnapshotId          string `json:"snapshot_id"`
	VolumeSize          int64  `json:"volume_size"`
	VolumeType          string `json:"volume_type"`
	Encrypted           bool   `json:"encrypted"`
}

type Ec2InstanceCreateRequest added in v0.8.0

type Ec2InstanceCreateRequest struct {
	Type            *string          `json:"type"`
	Image           *string          `json:"image"`
	Subnet          *string          `json:"subnet"`
	Sgs             []*string        `json:"sgs"`
	CpuCredits      *string          `json:"cpu_credits"`
	InstanceProfile *string          `json:"instanceprofile"`
	Key             *string          `json:"key"`
	Userdata64      *string          `json:"userdata64"`
	BlockDevices    []Ec2BlockDevice `json:"block_devices"`
}

type Ec2InstanceResponse

type Ec2InstanceResponse struct {
	Az        string              `json:"az"`
	CreatedAt string              `json:"created_at"`
	CreatedBy string              `json:"created_by"`
	ID        string              `json:"id"`
	Image     string              `json:"image"`
	Ip        string              `json:"ip"`
	Key       string              `json:"key"`
	Name      string              `json:"name"`
	Platform  string              `json:"platform"`
	Sgs       []map[string]string `json:"sgs"`
	State     string              `json:"state"`
	Subnet    string              `json:"subnet"`
	Tags      []map[string]string `json:"tags"`
	Type      string              `json:"type"`
	Volumes   map[string]*Volume  `json:"volumes"`
}

type Ec2InstanceStateChangeRequest added in v0.12.0

type Ec2InstanceStateChangeRequest struct {
	State string `json:"state"`
}

type Ec2InstanceUpdateRequest added in v0.14.0

type Ec2InstanceUpdateRequest struct {
	Tags         map[string]string `json:"tags"`
	InstanceType map[string]string `json:"instance_type"`
}

type Ec2SecurityGroupIpPermission added in v0.2.4

type Ec2SecurityGroupIpPermission struct {
	FromPort         int64                              `json:"from_port,omitempty"`
	IpProtocol       string                             `json:"ip_protocol,omitempty"`
	IpRanges         []*Ec2SecurityGroupIpRange         `json:"ip_ranges"`
	Ipv6Ranges       []*Ec2SecurityGroupIpv6Range       `json:"ipv_6_ranges"`
	PrefixListIds    []*Ec2SecurityGroupPrefixListId    `json:"prefix_list_ids"`
	ToPort           int64                              `json:"to_port,omitempty"`
	UserIdGroupPairs []*Ec2SecurityGroupUserIdGroupPair `json:"user_id_group_pairs"`
}

type Ec2SecurityGroupIpRange added in v0.2.4

type Ec2SecurityGroupIpRange struct {
	CidrIp      string `json:"cidr_ip,omitempty"`
	Description string `json:"description,omitempty"`
}

type Ec2SecurityGroupIpv6Range added in v0.2.4

type Ec2SecurityGroupIpv6Range struct {
	CidrIpv6    string `json:"cidr_ipv_6,omitempty"`
	Description string `json:"description,omitempty"`
}

type Ec2SecurityGroupPrefixListId added in v0.2.4

type Ec2SecurityGroupPrefixListId struct {
	Description  string `json:"description,omitempty"`
	PrefixListId string `json:"prefix_list_id,omitempty"`
}

type Ec2SecurityGroupRequest added in v0.6.0

type Ec2SecurityGroupRequest struct {
	Description string                         `json:"description"`
	GroupName   string                         `json:"group_name"`
	InitRules   []*Ec2SecurityGroupRuleRequest `json:"init_rules"`
	Tags        []map[string]string            `json:"tags"`
	VpcId       string                         `json:"vpc_id"`
}

type Ec2SecurityGroupResponse added in v0.2.4

type Ec2SecurityGroupResponse struct {
	Description   string                          `json:"description"`
	GroupId       string                          `json:"group_id"`
	GroupName     string                          `json:"group_name"`
	IncomingRules []*Ec2SecurityGroupIpPermission `json:"incoming_rules"`
	OutgoingRules []*Ec2SecurityGroupIpPermission `json:"outgoing_rules"`
	Tags          []map[string]string             `json:"tags"`
	VpcId         string                          `json:"vpc_id"`
}

type Ec2SecurityGroupRuleRequest added in v0.6.0

type Ec2SecurityGroupRuleRequest struct {
	RuleType    *string            `json:"rule_type"`   // Direction of traffic: [inbound|outbound]
	Action      *string            `json:"action"`      // Adding or removing the rule: [add|remove]
	CidrIp      *string            `json:"cidr_ip"`     // IPv4 CIDR address range to allow traffic to/from
	SgId        *string            `json:"sg_id"`       // Security group to allow traffic to/from
	IpProtocol  *string            `json:"ip_protocol"` // IP Protocol name [tcp|udp|icmp|-1]
	FromPort    *int64             `json:"from_port"`   // The starting port (not required if Protocol -1)
	ToPort      *int64             `json:"to_port"`     // The ending port (not required if Protocol -1)
	Description *string            `json:"description"` // Optional description for this rule
	Tags        *map[string]string `json:"tags,omitempty"`
}

type Ec2SecurityGroupUserIdGroupPair added in v0.2.4

type Ec2SecurityGroupUserIdGroupPair struct {
	Description          string `json:"description,omitempty"`
	GroupId              string `json:"group_id,omitempty"`
	GroupName            string `json:"group_name,omitempty"`
	PeeringStatus        string `json:"peering_status,omitempty"`
	UserId               string `json:"user_id,omitempty"`
	VpcId                string `json:"vpc_id,omitempty"`
	VpcPeeringConnection string `json:"vpc_peering_connection,omitempty"`
}

type Ec2SnapshotCreateRequest added in v0.18.0

type Ec2SnapshotCreateRequest struct {
	VolumeId    *string `json:"volume_id"`
	Description *string `json:"description"`
	CopyTags    *bool   `json:"copy_tags"`
}

type Ec2SnapshotResponse

type Ec2SnapshotResponse struct {
	CreatedAt   string              `json:"created_at"`
	Description string              `json:"description"`
	Encrypted   bool                `json:"encrypted"`
	ID          string              `json:"id"`
	Owner       string              `json:"owner"`
	Progress    string              `json:"progress"`
	Size        int64               `json:"size"`
	State       string              `json:"state"`
	Tags        []map[string]string `json:"tags"`
	VolumeID    string              `json:"volume_id"`
}

type Ec2SubnetResponse added in v0.27.0

type Ec2SubnetResponse struct {
	Id               string              `json:"id"`
	VpcId            string              `json:"vpc_id"`
	AvailabilityZone string              `json:"availability_zone"`
	DefaultForAz     bool                `json:"default_for_az"`
	CIDRBlock        string              `json:"cidr_block"`
	State            string              `json:"state"`
	Tags             []map[string]string `json:"tags"`
}

type Ec2VolumeAttachment

type Ec2VolumeAttachment struct {
	AttachTime          string `json:"attach_time"`
	Device              string `json:"device"`
	InstanceID          string `json:"instance_id"`
	State               string `json:"state"`
	VolumeID            string `json:"volume_id"`
	DeleteOnTermination bool   `json:"delete_on_termination"`
}

type Ec2VolumeAttachmentRequest added in v0.20.0

type Ec2VolumeAttachmentRequest struct {
	Device              *string `json:"device"`
	VolumeID            *string `json:"volume_id"`
	DeleteOnTermination *bool   `json:"delete_on_termination"`
}

type Ec2VolumeCreateRequest added in v0.11.0

type Ec2VolumeCreateRequest struct {
	Type       *string `json:"type"`
	Size       *int64  `json:"size"`
	Iops       *int64  `json:"iops"`
	AZ         *string `json:"az"`
	SnapshotId *string `json:"snapshot_id"`
	KmsKeyId   *string `json:"kms_key_id"`
	Encrypted  *bool   `json:"encrypted"`
}

type Ec2VolumeModification added in v0.7.0

type Ec2VolumeModification struct {
	EndTime                    string `json:"end_time"`
	ModificationState          string `json:"modification_state"`
	OriginalIops               int64  `json:"original_iops"`
	OriginalMultiAttachEnabled bool   `json:"original_multi_attach_enabled"`
	OriginalSize               int64  `json:"original_size"`
	OriginalThroughput         int64  `json:"original_throughput"`
	OriginalVolumeType         string `json:"original_volume_type"`
	Progress                   int64  `json:"progress"`
	StartTime                  string `json:"start_time"`
	StatusMessage              string `json:"status_message"`
	TargetIops                 int64  `json:"target_iops"`
	TargetMultiAttachEnabled   bool   `json:"target_multi_attach_enabled"`
	TargetSize                 int64  `json:"target_size"`
	TargetThroughput           int64  `json:"target_throughput"`
	TargetVolumeType           string `json:"target_volume_type"`
	VolumeId                   string `json:"volume_id"`
}

type Ec2VolumeResponse

type Ec2VolumeResponse struct {
	CreatedAt   string                 `json:"created_at"`
	ID          string                 `json:"id"`
	Size        int64                  `json:"size"`
	Iops        int64                  `json:"iops"`
	Encrypted   bool                   `json:"encrypted"`
	State       string                 `json:"state"`
	Tags        []map[string]string    `json:"tags"`
	Type        string                 `json:"type"`
	Attachments []*Ec2VolumeAttachment `json:"attachments"`
}

type Ec2VolumeUpdateRequest added in v0.15.0

type Ec2VolumeUpdateRequest struct {
	Type *string            `json:"type"`
	Size *int64             `json:"size"`
	Iops *int64             `json:"iops"`
	Tags *map[string]string `json:"tags,omitempty"`
}

type Ec2VpcResponse added in v0.9.0

type Ec2VpcResponse struct {
	Id              string              `json:"id"`
	CIDRBlock       string              `json:"cidr_block"`
	DHCPOptionsId   string              `json:"dhcp_options_id"`
	State           string              `json:"state"`
	InstanceTenancy string              `json:"instance_tenancy"`
	IsDefault       bool                `json:"is_default"`
	Tags            []map[string]string `json:"tags"`
}

type LogWriter

type LogWriter struct {
	http.ResponseWriter
}

LogWriter is an http.ResponseWriter

func (LogWriter) Write

func (w LogWriter) Write(p []byte) (n int, err error)

Write log message if http response writer returns an error

type SSMAssociationRequest added in v0.14.0

type SSMAssociationRequest struct {
	Document string `json:"document"`
}

type SSMGetCommandInvocationOutput added in v0.9.0

type SSMGetCommandInvocationOutput struct {
	CommandId              string                 `json:"command_id"`
	InstanceId             string                 `json:"instance_id"`
	Comment                string                 `json:"comment"`
	DocumentName           string                 `json:"document_name"`
	DocumentVersion        string                 `json:"document_version"`
	PluginName             string                 `json:"plugin_name"`
	ResponseCode           int                    `json:"response_code"`
	ExecutionStartDateTime string                 `json:"execution_start_date_time"`
	ExecutionElapsedTime   string                 `json:"execution_elapsed_time"`
	ExecutionEndDateTime   string                 `json:"execution_end_date_time"`
	Status                 string                 `json:"status"`
	StatusDetails          string                 `json:"status_details"`
	StandardOutputContent  string                 `json:"standard_output_content"`
	StandardOutputURL      string                 `json:"standard_output_url"`
	StandardErrorContent   string                 `json:"standard_error_content"`
	StandardErrorURL       string                 `json:"standard_error_url"`
	CloudWatchOutputConfig CloudWatchOutputConfig `json:"cloud_watch_output_config"`
}

type SsmCommandRequest added in v0.13.0

type SsmCommandRequest struct {
	DocumentName   string               `json:"document_name"`
	Parameters     map[string][]*string `json:"parameters"`
	TimeoutSeconds *int64               `json:"timeout"`
}

type Volume

type Volume struct {
	AttachTime          string `json:"attach_time"`
	DeleteOnTermination bool   `json:"delete_on_termination"`
	Status              string `json:"status"`
	DeviceName          string `json:"device_name"`
}

Jump to

Keyboard shortcuts

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