sdk

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShapeNameTemplateList = "%sList"
	ShapeNameTemplateMap  = "%sMap"
	ShapeNameTemplateKey  = "%sKey"
)

Variables

View Source
var (
	ErrInvalidVersionDirectory = errors.New(
		"expected to find only directories in api model directory but found non-directory",
	)
	ErrNoValidVersionDirectory = errors.New(
		"no valid version directories found",
	)
	ErrServiceNotFound = errors.New(
		"no such service",
	)
	ErrAPIVersionNotFound = errors.New(
		"no such api version",
	)
)
View Source
var (
	ErrMemberShapeNotFound = errors.New("base shape not found")
)

Functions

func ContextWithSigterm added in v0.19.3

func ContextWithSigterm(ctx context.Context) (context.Context, context.CancelFunc)

func EnsureDir added in v0.19.3

func EnsureDir(fp string) (bool, error)

EnsureDir makes sure that a supplied directory exists and returns whether the directory already existed.

func EnsureRepo added in v0.19.3

func EnsureRepo(
	ctx context.Context,
	cacheDir string,

	fetchTags bool,
	awsSDKGoVersion string,
	controllerRepoPath string,
) (string, error)

EnsureRepo ensures that we have a git clone'd copy of the aws-sdk-go repository, which we use model JSON files from. Upon successful return of this function, the sdkDir global variable will be set to the directory where the aws-sdk-go is found. It will also optionally fetch all the remote tags and checkout the given tag.

Types

type Helper

type Helper struct {
	// Default is "services.k8s.aws"
	APIGroupSuffix string
	// contains filtered or unexported fields
}

Helper is a helper struct that helps work with the aws-sdk-go models and API model loader

func NewHelper

func NewHelper(basePath string, cfg ackgenconfig.Config) *Helper

NewHelper returns a new SDKHelper object

func (*Helper) API

func (h *Helper) API(serviceModelName string) (*model.SDKAPI, error)

API returns the aws-sdk-go API model for a supplied service model name.

func (*Helper) FirstAPIVersion

func (h *Helper) FirstAPIVersion(serviceModelName string) (string, error)

FirstAPIVersion returns the first found API version for a service API. (e.h. "2012-10-03")

func (*Helper) GetAPIVersions

func (h *Helper) GetAPIVersions(serviceModelName string) ([]string, error)

GetAPIVersions returns the list of API Versions found in a service directory.

func (*Helper) InjectCustomShapes

func (h *Helper) InjectCustomShapes(sdkapi *ackmodel.SDKAPI) error

InjectCustomShapes will create custom shapes for each of the spec and status fields that contain CustomFieldConfig values. It will append these values into the list of shapes in the API and update the list of custom shapes in the SDKAPI object.

func (*Helper) ModelAndDocsPath

func (h *Helper) ModelAndDocsPath(
	serviceModelName string,
) (string, string, error)

ModelAndDocsPath returns two string paths to the supplied service's API and doc JSON files

func (*Helper) WithAPIVersion

func (h *Helper) WithAPIVersion(apiVersion string)

WithAPIVersion sets the `apiVersion` field.

func (*Helper) WithSDKVersion

func (h *Helper) WithSDKVersion(version string) error

WithSDKVersion checks out the sdk git repository to the provided version. To use this function h.basePath should point to a git repository.

Jump to

Keyboard shortcuts

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