api

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Copyright © 2020 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

View Source
var EcrAdminPolicy = iam.PolicyDocument{
	Version: "2012-10-17",
	Statement: []iam.StatementEntry{
		{
			Sid:    "AllowActionsOnRepositoriesInSpaceAndOrg",
			Effect: "Allow",
			Action: []string{
				"ecr:PutLifecyclePolicy",
				"ecr:PutImageTagMutability",
				"ecr:DescribeImageScanFindings",
				"ecr:GetDownloadUrlForLayer",
				"ecr:GetAuthorizationToken",
				"ecr:UploadLayerPart",
				"ecr:BatchDeleteImage",
				"ecr:ListImages",
				"ecr:DeleteLifecyclePolicy",
				"ecr:PutImage",
				"ecr:BatchGetImage",
				"ecr:CompleteLayerUpload",
				"ecr:DescribeImages",
				"ecr:DeleteRegistryPolicy",
				"ecr:InitiateLayerUpload",
				"ecr:BatchCheckLayerAvailability",
			},
			Resource: []string{"*"},
			Condition: iam.Condition{
				"StringEqualsIgnoreCase": iam.ConditionStatement{
					"aws:ResourceTag/Name":           []string{"${aws:PrincipalTag/ResourceName}"},
					"aws:ResourceTag/spinup:org":     []string{"${aws:PrincipalTag/spinup:org}"},
					"aws:ResourceTag/spinup:spaceid": []string{"${aws:PrincipalTag/spinup:spaceid}"},
				},
			},
		},
		{
			Sid:      "AllowDockerLogin",
			Effect:   "Allow",
			Action:   []string{"ecr:GetAuthorizationToken"},
			Resource: []string{"*"},
		},
	},
}

Functions

func NewServer

func NewServer(config common.Config) error

NewServer creates a new server and starts it

func TokenMiddleware

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

TokenMiddleware checks the tokens for non-public URLs

Types

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 RepositoryCreateRequest

type RepositoryCreateRequest struct {
	// Specify a custom KmsKeyId.  This will also change the encryption type from
	// 'AES256' to 'KMS'.  By default, when no encryption configuration is set or
	// the AES256 encryption type is used, Amazon ECR uses server-side encryption
	// with Amazon S3-managed encryption keys which encrypts your data at rest using
	// an AES-256 encryption algorithm.
	// Note: AWS KMS enforces a limit of 500 grants per CMK. As a result, there is
	// a limit of 500 Amazon ECR repositories that can be encrypted per CMK.
	KmsKeyId string

	// The setting that determines whether images are scanned after being pushed
	// to a repository. If set to true, images will be scanned after being pushed.
	// If this parameter is not specified, it will default to false and images will
	// not be scanned unless a scan is manually started with the StartImageScan
	// API.
	ScanOnPush string

	// The name to use for the repository. The repository name may be specified
	// on its own (such as nginx-web-app) or it can be prepended with a namespace
	// to group the repository into a category (such as project-a/nginx-web-app)
	RepositoryName string

	// List of additioal group ids that should have access to the repository
	Groups []string

	// Tags to apply to the repository
	Tags []*Tag
}

RepositoryCreateRequest is the payload for creating an ECR repository

type RepositoryResponse

type RepositoryResponse struct {
	CreatedAt          time.Time
	EncryptionType     string
	Groups             []string
	KmsKeyId           string
	ScanOnPush         string
	ImageTagMutability string
	RegistryId         string
	RepositoryArn      string
	RepositoryName     string
	RepositoryUri      string
	Tags               []*Tag
}

RepositoryResponse is the response payload for repository operations

type RepositoryUpdateRequest

type RepositoryUpdateRequest struct {
	Groups     []string
	ScanOnPush string
	Tags       []*Tag
}

RepositoryUpdateRequest is the payload for updating an ECR repository

type RepositoryUserCreateRequest added in v0.2.0

type RepositoryUserCreateRequest struct {
	UserName string
	Groups   []string
	Tags     []*Tag
}

RepositoryUserCreateRequest is the request payload for creating a repository user

type RepositoryUserResponse added in v0.2.0

type RepositoryUserResponse struct {
	UserName          string
	AccessKeys        []*iam.AccessKeyMetadata `json:",omitempty"`
	AccessKey         *iam.AccessKey           `json:",omitempty"`
	DeletedAccessKeys []string                 `json:",omitempty"`
	Groups            []string                 `json:",omitempty"`
	Tags              []*Tag
}

RepositoryUserResponse is the response payload for user operations

type RepositoryUserUpdateRequest added in v0.3.0

type RepositoryUserUpdateRequest struct {
	ResetKey bool
	Tags     []*Tag
}

RepositoryUserUpdateRequest is the request payload for updating a user

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is our AWS compatible tag struct that can be converted to specific tag types

Jump to

Keyboard shortcuts

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