util

package
v0.9.2-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeUserToken

func DecodeUserToken(jwtTokenString, jwtSecret string, rawPubKey []byte) (*platform.User, error)

DecodeUserToken decodes a jwtToken (HS256 and RS256) into a *platform.User

func DeleteNullKeysFromObjectMeta

func DeleteNullKeysFromObjectMeta(obj *metav1.ObjectMeta)

DeleteNullKeysFromObjectMeta will remove any key with an empty string in .metadata.labels and .metadata.annotations

func GenAdler32Hash

func GenAdler32Hash(text string) string

GenAdler32Hash generates a adler32 hash from a given string

func GenerateNewJwtToken

func GenerateNewJwtToken(key, customer, org string, tokenType platform.TokenType, exp time.Time) (string, error)

GenerateNewJwtToken creates a new user token to allow machine-to-machine interaction

func StatusBadRequest

func StatusBadRequest(msg string, obj runtime.Object, reason metav1.StatusReason) *metav1.Status

StatusBadRequest returns a *metav1.Status with 400 status code

func StatusConflict

func StatusConflict(msg string, obj runtime.Object, details *metav1.StatusDetails) *metav1.Status

StatusConflict returns a *metav1.Status with 409 status code

func StatusForbidden

func StatusForbidden(msg string, obj runtime.Object, reason metav1.StatusReason) *metav1.Status

StatusForbidden returns a *metav1.Status with 403 status code

func StatusInternalError

func StatusInternalError(msg string, obj runtime.Object) *metav1.Status

StatusInternalError returns a *metav1.Status with 500 status code

func StatusMethodNotAllowed

func StatusMethodNotAllowed(msg string, obj runtime.Object) *metav1.Status

StatusMethodNotAllowed returns a *metav1.Status with 405 status code

func StatusNotFound

func StatusNotFound(msg string, obj runtime.Object) *metav1.Status

StatusNotFound returns a *metav1.Status with 404 status code

func StatusUnauthorized

func StatusUnauthorized(msg string, obj runtime.Object, reason metav1.StatusReason) *metav1.Status

StatusUnauthorized returns a *metav1.Status with 401 status code

func StatusUnprocessableEntity

func StatusUnprocessableEntity(msg string, obj runtime.Object, details *metav1.StatusDetails) *metav1.Status

StatusUnprocessableEntity returns a *metav1.Status with 422 status code

func StrategicMergePatch

func StrategicMergePatch(codec runtime.Codec, original, new runtime.Object) ([]byte, error)

StrategicMergePatch creates a strategic merge patch and merge with the original object https://github.com/kubernetes/community/blob/master/contributors/devel/strategic-merge-patch.md

func WriteResponseCreated

func WriteResponseCreated(w http.ResponseWriter, data []byte)

func WriteResponseError

func WriteResponseError(w http.ResponseWriter, status *metav1.Status)

func WriteResponseNoContent

func WriteResponseNoContent(w http.ResponseWriter)

func WriteResponseSuccess

func WriteResponseSuccess(w http.ResponseWriter, data []byte)

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder known how to decode a io.Reader into a Kubernetes resource

func NewDecoder

func NewDecoder(r io.Reader, dec runtime.Decoder) *Decoder

NewDecoder creates a new Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v runtime.Object) error

Decode it's a helper function to decode a []byte into a known kubernetes resource

type ErrInvalidGitSha

type ErrInvalidGitSha struct {
	// contains filtered or unexported fields
}

ErrInvalidGitSha is returned by NewSha if the given raw sha is invalid for any reason.

func (ErrInvalidGitSha) Error

func (e ErrInvalidGitSha) Error() string

Error is the error interface implementation.

type SHA

type SHA struct {
	// contains filtered or unexported fields
}

SHA is the representaton of a git sha

func NewSha

func NewSha(rawSha string) (*SHA, error)

NewSha creates a raw string to a SHA. Returns ErrInvalidGitSha if the sha was invalid.

func (SHA) Full

func (s SHA) Full() string

Full returns the full git sha.

func (SHA) Short

func (s SHA) Short() string

Short returns the first 8 characters of the sha.

type SlugBuilderInfo

type SlugBuilderInfo struct {
	// contains filtered or unexported fields
}

SlugBuilderInfo contains all of the object storage related information needed to pass to a slug builder.

func NewSlugBuilderInfo

func NewSlugBuilderInfo(namespace, deployName, prefix string, sha *SHA) *SlugBuilderInfo

NewSlugBuilderInfo creates and populates a new SlugBuilderInfo based on the given data

func (SlugBuilderInfo) PushKey

func (s SlugBuilderInfo) PushKey() string

PushKey returns the object storage key that the slug builder will store the slug in. The returned value only contains the path to the folder, not including the final filename.

func (SlugBuilderInfo) TarKey

func (s SlugBuilderInfo) TarKey() string

TarKey returns the object storage key from which the slug builder will download for the tarball (from which it uses to build the slug). The returned value only contains the path to the folder, not including the final filename.

Jump to

Keyboard shortcuts

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