validation

package
v0.0.0-...-c23f332 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateExactlyOneOfStringFlagNotEmpty

func ValidateExactlyOneOfStringFlagNotEmpty(flagKeyValues map[string]string) error

ValidateExactlyOneOfStringFlagNotEmpty returns error with error message stating one of fields must be provided if value is empty string. Returns nil otherwise.

func ValidateFqdn

func ValidateFqdn(flagValue string, flagKey string) error

ValidateFqdn validates fully qualified domain name

func ValidateImageName

func ValidateImageName(value string) error

ValidateImageName validates whether a string is a valid image name, as defined by <https://cloud.google.com/compute/docs/reference/rest/v1/images>.

func ValidateImageURI

func ValidateImageURI(value string) (project string, imageName string, err error)

ValidateImageURI validates whether a string is a valid image URI, as defined by <https://cloud.google.com/compute/docs/reference/rest/v1/images> and returns image name and project ID if valid.

func ValidateProjectID

func ValidateProjectID(value string) error

ValidateProjectID validates whether a string is a valid projectID, as defined by <https://cloud.google.com/resource-manager/reference/rest/v1/projects>.

func ValidateRfc1035Label

func ValidateRfc1035Label(value string) error

ValidateRfc1035Label validates a single label per RFC 1035

func ValidateSnapshotName

func ValidateSnapshotName(value string) error

ValidateSnapshotName validates whether a string is a valid disk snapshot name, as defined by <https://cloud.google.com/compute/docs/reference/rest/v1/snapshots>.

func ValidateStringFlagNotEmpty

func ValidateStringFlagNotEmpty(flagValue string, flagKey string) error

ValidateStringFlagNotEmpty returns error with error message stating field must be provided if value is empty string. Returns nil otherwise.

func ValidateStruct

func ValidateStruct(s interface{}) error

ValidateStruct performs struct field validation based on field tags.

Use the syntax from <https://github.com/go-playground/validator>. In addition, the following is supported:

New validators:
  gce_disk_image_name:  Validates using `ValidateImageName`

Field names:
  To customize the field name in the error message, include a tag named 'name'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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