pivnet

package module
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

README

HEAVILY UNDER CONSTRUCTION

Presently, you are using this at your own risk.

There are definitely some improvements forth coming:

  • godoc all the things
  • refactor the client method, the interface will not change though
  • work though adding all of the pivnet methods (this will take awhile)

Running the tests

Install the ginkgo executable with:

go get -u github.com/onsi/ginkgo/ginkgo

The tests require a valid Pivotal Network API token and host.

Refer to the official docs for more details on obtaining a Pivotal Network API token.

It is advised to run the acceptance tests against the Pivotal Network integration environment endpoint i.e. HOST='https://pivnet-integration.cfapps.io'.

Run the tests with the following command:

API_TOKEN=my-token \
HOST='https://pivnet-integration.cfapps.io' \
./bin/test_all

Contributing

Please make all pull requests to the develop branch, and ensure the tests pass locally.

Project management

The CI for this project can be found at https://sunrise.ci.cf-app.com and the scripts can be found in the pivnet-resource-ci repo.

The roadmap is captured in Pivotal Tracker.

Documentation

Index

Constants

View Source
const (
	FileTypeSoftware          = "Software"
	FileTypeDocumentation     = "Documentation"
	FileTypeOpenSourceLicense = "Open Source License"
)
View Source
const (
	DefaultHost = "https://network.pivotal.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func (AuthService) Check

func (e AuthService) Check() error

type Client

type Client struct {
	Auth                *AuthService
	EULA                *EULAsService
	ProductFiles        *ProductFilesService
	FileGroups          *FileGroupsService
	Releases            *ReleasesService
	Products            *ProductsService
	UserGroups          *UserGroupsService
	ReleaseDependencies *ReleaseDependenciesService
	ReleaseTypes        *ReleaseTypesService
	ReleaseUpgradePaths *ReleaseUpgradePathsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config ClientConfig, logger logger.Logger) Client

func (Client) CreateRequest

func (c Client) CreateRequest(
	requestType string,
	endpoint string,
	body io.Reader,
) (*http.Request, error)

func (Client) MakeRequest

func (c Client) MakeRequest(
	requestType string,
	endpoint string,
	expectedStatusCode int,
	body io.Reader,
	data interface{},
) (*http.Response, []byte, error)

type ClientConfig

type ClientConfig struct {
	Host      string
	Token     string
	UserAgent string
}

type CreateProductFileConfig

type CreateProductFileConfig struct {
	ProductSlug  string
	FileVersion  string
	AWSObjectKey string
	Name         string
	MD5          string
	Description  string
	FileType     string
}

type CreateReleaseConfig

type CreateReleaseConfig struct {
	ProductSlug           string
	Version               string
	ReleaseType           string
	ReleaseDate           string
	EULASlug              string
	Description           string
	ReleaseNotesURL       string
	Controlled            bool
	ECCN                  string
	LicenseException      string
	EndOfSupportDate      string
	EndOfGuidanceDate     string
	EndOfAvailabilityDate string
}

type CreateReleaseResponse

type CreateReleaseResponse struct {
	Release Release `json:"release,omitempty"`
}

type DependentRelease

type DependentRelease struct {
	ID      int     `json:"id,omitempty" yaml:"id,omitempty"`
	Version string  `json:"version,omitempty" yaml:"version,omitempty"`
	Product Product `json:"product,omitempty" yaml:"product,omitempty"`
}

type EULA

type EULA struct {
	Slug    string `json:"slug,omitempty" yaml:"slug,omitempty"`
	ID      int    `json:"id,omitempty" yaml:"id,omitempty"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Content string `json:"content,omitempty" yaml:"content,omitempty"`
	Links   *Links `json:"_links,omitempty" yaml:"_links,omitempty"`
}

type EULAAcceptanceResponse

type EULAAcceptanceResponse struct {
	AcceptedAt string `json:"accepted_at,omitempty"`
	Links      *Links `json:"_links,omitempty"`
}

type EULAsResponse

type EULAsResponse struct {
	EULAs []EULA `json:"eulas,omitempty"`
	Links *Links `json:"_links,omitempty"`
}

type EULAsService

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

func (EULAsService) Accept

func (e EULAsService) Accept(productSlug string, releaseID int) error

func (EULAsService) Get

func (e EULAsService) Get(eulaSlug string) (EULA, error)

func (EULAsService) List

func (e EULAsService) List() ([]EULA, error)

type ErrNotFound

type ErrNotFound struct {
	ResponseCode int    `json:"response_code" yaml:"response_code"`
	Message      string `json:"message" yaml:"message"`
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type ErrPivnetOther

type ErrPivnetOther struct {
	ResponseCode int      `json:"response_code" yaml:"response_code"`
	Message      string   `json:"message" yaml:"message"`
	Errors       []string `json:"errors" yaml:"errors"`
}

func (ErrPivnetOther) Error

func (e ErrPivnetOther) Error() string

type ErrUnauthorized

type ErrUnauthorized struct {
	ResponseCode int    `json:"response_code" yaml:"response_code"`
	Message      string `json:"message" yaml:"message"`
}

func (ErrUnauthorized) Error

func (e ErrUnauthorized) Error() string

type FileGroup

type FileGroup struct {
	ID           int              `json:"id,omitempty" yaml:"id,omitempty"`
	Name         string           `json:"name,omitempty" yaml:"name,omitempty"`
	Product      FileGroupProduct `json:"product,omitempty" yaml:"product,omitempty"`
	ProductFiles []ProductFile    `json:"product_files,omitempty" yaml:"product_files,omitempty"`
}

type FileGroupProduct

type FileGroupProduct struct {
	ID   int    `json:"id,omitempty" yaml:"id,omitempty"`
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

type FileGroupsResponse

type FileGroupsResponse struct {
	FileGroups []FileGroup `json:"file_groups,omitempty"`
}

type FileGroupsService

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

func (FileGroupsService) AddToRelease

func (r FileGroupsService) AddToRelease(
	productSlug string,
	releaseID int,
	fileGroupID int,
) error

func (FileGroupsService) Create

func (p FileGroupsService) Create(productSlug string, name string) (FileGroup, error)

func (FileGroupsService) Delete

func (p FileGroupsService) Delete(productSlug string, id int) (FileGroup, error)

func (FileGroupsService) Get

func (p FileGroupsService) Get(productSlug string, fileGroupID int) (FileGroup, error)

func (FileGroupsService) List

func (e FileGroupsService) List(productSlug string) ([]FileGroup, error)

func (FileGroupsService) ListForRelease

func (p FileGroupsService) ListForRelease(productSlug string, releaseID int) ([]FileGroup, error)

func (FileGroupsService) RemoveFromRelease

func (r FileGroupsService) RemoveFromRelease(
	productSlug string,
	releaseID int,
	fileGroupID int,
) error

func (FileGroupsService) Update

func (p FileGroupsService) Update(productSlug string, fileGroup FileGroup) (FileGroup, error)
type Links struct {
	EULA           map[string]string `json:"eula,omitempty" yaml:"eula,omitempty"`
	Download       map[string]string `json:"download,omitempty" yaml:"download,omitempty"`
	ProductFiles   map[string]string `json:"product_files,omitempty" yaml:"product_files,omitempty"`
	EULAAcceptance map[string]string `json:"eula_acceptance,omitempty" yaml:"eula_acceptance,omitempty"`
}

type Product

type Product struct {
	ID   int    `json:"id,omitempty" yaml:"id,omitempty"`
	Slug string `json:"slug,omitempty" yaml:"slug,omitempty"`
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

type ProductFile

type ProductFile struct {
	ID           int    `json:"id,omitempty" yaml:"id,omitempty"`
	AWSObjectKey string `json:"aws_object_key,omitempty" yaml:"aws_object_key,omitempty"`
	Links        *Links `json:"_links,omitempty" yaml:"_links,omitempty"`
	FileType     string `json:"file_type,omitempty" yaml:"file_type,omitempty"`
	FileVersion  string `json:"file_version,omitempty" yaml:"file_version,omitempty"`
	Name         string `json:"name,omitempty" yaml:"name,omitempty"`
	MD5          string `json:"md5,omitempty" yaml:"md5,omitempty"`
	Description  string `json:"description,omitempty" yaml:"description,omitempty"`
	Size         int    `json:"size,omitempty" yaml:"size,omitempty"`
}

type ProductFileResponse

type ProductFileResponse struct {
	ProductFile ProductFile `json:"product_file,omitempty"`
}

type ProductFilesResponse

type ProductFilesResponse struct {
	ProductFiles []ProductFile `json:"product_files,omitempty"`
}

type ProductFilesService

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

func (ProductFilesService) AddToFileGroup

func (p ProductFilesService) AddToFileGroup(
	productSlug string,
	fileGroupID int,
	productFileID int,
) error

func (ProductFilesService) AddToRelease

func (p ProductFilesService) AddToRelease(
	productSlug string,
	releaseID int,
	productFileID int,
) error

func (ProductFilesService) Create

func (ProductFilesService) Delete

func (p ProductFilesService) Delete(productSlug string, id int) (ProductFile, error)

func (ProductFilesService) Get

func (p ProductFilesService) Get(productSlug string, productFileID int) (ProductFile, error)

func (ProductFilesService) GetForRelease

func (p ProductFilesService) GetForRelease(productSlug string, releaseID int, productFileID int) (ProductFile, error)

func (ProductFilesService) List

func (p ProductFilesService) List(productSlug string) ([]ProductFile, error)

func (ProductFilesService) ListForRelease

func (p ProductFilesService) ListForRelease(productSlug string, releaseID int) ([]ProductFile, error)

func (ProductFilesService) RemoveFromFileGroup

func (p ProductFilesService) RemoveFromFileGroup(
	productSlug string,
	fileGroupID int,
	productFileID int,
) error

func (ProductFilesService) RemoveFromRelease

func (p ProductFilesService) RemoveFromRelease(
	productSlug string,
	releaseID int,
	productFileID int,
) error

func (ProductFilesService) Update

func (p ProductFilesService) Update(productSlug string, productFile ProductFile) (ProductFile, error)

type ProductsResponse

type ProductsResponse struct {
	Products []Product `json:"products,omitempty"`
}

type ProductsService

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

func (ProductsService) Get

func (p ProductsService) Get(slug string) (Product, error)

func (ProductsService) List

func (p ProductsService) List() ([]Product, error)

type Release

type Release struct {
	ID                    int         `json:"id,omitempty" yaml:"id,omitempty"`
	Availability          string      `json:"availability,omitempty" yaml:"availability,omitempty"`
	EULA                  *EULA       `json:"eula,omitempty" yaml:"eula,omitempty"`
	OSSCompliant          string      `json:"oss_compliant,omitempty" yaml:"oss_compliant,omitempty"`
	ReleaseDate           string      `json:"release_date,omitempty" yaml:"release_date,omitempty"`
	ReleaseType           ReleaseType `json:"release_type,omitempty" yaml:"release_type,omitempty"`
	Version               string      `json:"version,omitempty" yaml:"version,omitempty"`
	Links                 *Links      `json:"_links,omitempty" yaml:"_links,omitempty"`
	Description           string      `json:"description,omitempty" yaml:"description,omitempty"`
	ReleaseNotesURL       string      `json:"release_notes_url,omitempty" yaml:"release_notes_url,omitempty"`
	Controlled            bool        `json:"controlled,omitempty" yaml:"controlled,omitempty"`
	ECCN                  string      `json:"eccn,omitempty" yaml:"eccn,omitempty"`
	LicenseException      string      `json:"license_exception,omitempty" yaml:"license_exception,omitempty"`
	EndOfSupportDate      string      `json:"end_of_support_date,omitempty" yaml:"end_of_support_date,omitempty"`
	EndOfGuidanceDate     string      `json:"end_of_guidance_date,omitempty" yaml:"end_of_guidance_date,omitempty"`
	EndOfAvailabilityDate string      `json:"end_of_availability_date,omitempty" yaml:"end_of_availability_date,omitempty"`
}

type ReleaseDependenciesResponse

type ReleaseDependenciesResponse struct {
	ReleaseDependencies []ReleaseDependency `json:"dependencies,omitempty"`
}

type ReleaseDependenciesService

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

func (ReleaseDependenciesService) Add

func (r ReleaseDependenciesService) Add(
	productSlug string,
	releaseID int,
	dependentReleaseID int,
) error

func (ReleaseDependenciesService) List

func (r ReleaseDependenciesService) List(productSlug string, releaseID int) ([]ReleaseDependency, error)

func (ReleaseDependenciesService) Remove

func (r ReleaseDependenciesService) Remove(
	productSlug string,
	releaseID int,
	dependentReleaseID int,
) error

type ReleaseDependency

type ReleaseDependency struct {
	Release DependentRelease `json:"release,omitempty" yaml:"release,omitempty"`
}

type ReleaseType

type ReleaseType string

type ReleaseTypesResponse

type ReleaseTypesResponse struct {
	ReleaseTypes []ReleaseType `json:"release_types" yaml:"release_types"`
}

type ReleaseTypesService

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

func (ReleaseTypesService) Get

func (r ReleaseTypesService) Get() ([]ReleaseType, error)

type ReleaseUpgradePath

type ReleaseUpgradePath struct {
	Release UpgradePathRelease `json:"release,omitempty" yaml:"release,omitempty"`
}

type ReleaseUpgradePathsResponse

type ReleaseUpgradePathsResponse struct {
	ReleaseUpgradePaths []ReleaseUpgradePath `json:"upgrade_paths,omitempty"`
}

type ReleaseUpgradePathsService

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

func (ReleaseUpgradePathsService) Add

func (r ReleaseUpgradePathsService) Add(
	productSlug string,
	releaseID int,
	previousReleaseID int,
) error

func (ReleaseUpgradePathsService) Get

func (r ReleaseUpgradePathsService) Get(productSlug string, releaseID int) ([]ReleaseUpgradePath, error)

func (ReleaseUpgradePathsService) Remove

func (r ReleaseUpgradePathsService) Remove(
	productSlug string,
	releaseID int,
	previousReleaseID int,
) error

type ReleasesResponse

type ReleasesResponse struct {
	Releases []Release `json:"releases,omitempty"`
}

type ReleasesService

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

func (ReleasesService) Create

func (r ReleasesService) Create(config CreateReleaseConfig) (Release, error)

func (ReleasesService) Delete

func (r ReleasesService) Delete(productSlug string, release Release) error

func (ReleasesService) Get

func (r ReleasesService) Get(productSlug string, releaseID int) (Release, error)

func (ReleasesService) List

func (r ReleasesService) List(productSlug string) ([]Release, error)

func (ReleasesService) Update

func (r ReleasesService) Update(productSlug string, release Release) (Release, error)

type UpdateUserGroupResponse

type UpdateUserGroupResponse struct {
	UserGroup UserGroup `json:"user_group,omitempty"`
}

type UpgradePathRelease

type UpgradePathRelease struct {
	ID      int    `json:"id,omitempty" yaml:"id,omitempty"`
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

type UserGroup

type UserGroup struct {
	ID          int      `json:"id,omitempty" yaml:"id,omitempty"`
	Name        string   `json:"name,omitempty" yaml:"name,omitempty"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
	Members     []string `json:"members,omitempty" yaml:"members,omitempty"`
}

type UserGroupsResponse

type UserGroupsResponse struct {
	UserGroups []UserGroup `json:"user_groups,omitempty"`
}

type UserGroupsService

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

func (UserGroupsService) AddMemberToGroup

func (r UserGroupsService) AddMemberToGroup(
	userGroupID int,
	memberEmailAddress string,
	admin bool,
) (UserGroup, error)

func (UserGroupsService) AddToRelease

func (u UserGroupsService) AddToRelease(productSlug string, releaseID int, userGroupID int) error

func (UserGroupsService) Create

func (u UserGroupsService) Create(name string, description string, members []string) (UserGroup, error)

func (UserGroupsService) Delete

func (r UserGroupsService) Delete(userGroupID int) error

func (UserGroupsService) Get

func (u UserGroupsService) Get(userGroupID int) (UserGroup, error)

func (UserGroupsService) List

func (u UserGroupsService) List() ([]UserGroup, error)

func (UserGroupsService) ListForRelease

func (u UserGroupsService) ListForRelease(productSlug string, releaseID int) ([]UserGroup, error)

func (UserGroupsService) RemoveFromRelease

func (u UserGroupsService) RemoveFromRelease(productSlug string, releaseID int, userGroupID int) error

func (UserGroupsService) RemoveMemberFromGroup

func (r UserGroupsService) RemoveMemberFromGroup(userGroupID int, memberEmailAddress string) (UserGroup, error)

func (UserGroupsService) Update

func (u UserGroupsService) Update(userGroup UserGroup) (UserGroup, error)

Directories

Path Synopsis
extensionfakes
This file was generated by counterfeiter
This file was generated by counterfeiter
loggerfakes
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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