diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 49d63c06af64..c55f3f65e4c7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,9 +9,20 @@ updates: applies-to: security-updates patterns: - "*" + k8s: + patterns: + - "k8s.io/*" + - "sigs.k8s.io/*" + openshift: + patterns: + - "github.com/openshift/*" go-dependencies: patterns: - "*" + exclude-patterns: + - "k8s.io/*" + - "sigs.k8s.io/*" + - "github.com/openshift/*" labels: - "approved" - "lgtm" diff --git a/api/v1beta1/agentserviceconfig_types.go b/api/v1beta1/agentserviceconfig_types.go index 4c20183239bb..80f023115ef1 100644 --- a/api/v1beta1/agentserviceconfig_types.go +++ b/api/v1beta1/agentserviceconfig_types.go @@ -255,8 +255,8 @@ const ( // AgentServiceConfigStatus defines the observed state of AgentServiceConfig type AgentServiceConfigStatus struct { - Conditions []conditionsv1.Condition `json:"conditions,omitempty"` - ImmutableAnnotations map[string]string `json:"immutableAnnotations,omitempty"` + Conditions []conditionsv1.Condition `json:"conditions,omitempty"` + ImmutableAnnotations map[string]string `json:"immutableAnnotations,omitempty"` } // +kubebuilder:object:root=true diff --git a/api/v1beta1/infraenv_types.go b/api/v1beta1/infraenv_types.go index c661393580ef..6ef20d0fa305 100644 --- a/api/v1beta1/infraenv_types.go +++ b/api/v1beta1/infraenv_types.go @@ -25,11 +25,11 @@ import ( ) const ( - ImageCreatedReason = "ImageCreated" - ImageStateCreated = "Image has been created" - ImageCreationErrorReason = "ImageCreationError" - ImageStateFailedToCreate = "Failed to create image" - InfraEnvNameLabel = "infraenvs.agent-install.openshift.io" + ImageCreatedReason = "ImageCreated" + ImageStateCreated = "Image has been created" + ImageCreationErrorReason = "ImageCreationError" + ImageStateFailedToCreate = "Failed to create image" + InfraEnvNameLabel = "infraenvs.agent-install.openshift.io" MissingClusterDeploymentReason = "MissingClusterDeployment" MissingClusterDeploymentReference = "ClusterDeployment is missing" InfraEnvAvailableReason = "InfraEnvAvailable" @@ -50,7 +50,6 @@ type ClusterReference struct { const ( ImageCreatedCondition conditionsv1.ConditionType = "ImageCreated" ClusterDeploymentReference conditionsv1.ConditionType = "ClusterDeploymentReference" - ) type InfraEnvSpec struct { diff --git a/api/vendor/github.com/asaskevich/govalidator/types.go b/api/vendor/github.com/asaskevich/govalidator/types.go index c573abb51aff..e846711696d4 100644 --- a/api/vendor/github.com/asaskevich/govalidator/types.go +++ b/api/vendor/github.com/asaskevich/govalidator/types.go @@ -177,7 +177,7 @@ type ISO3166Entry struct { Numeric string } -//ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" +// ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" var ISO3166List = []ISO3166Entry{ {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"}, {"Albania", "Albanie (l')", "AL", "ALB", "008"}, @@ -467,7 +467,7 @@ type ISO693Entry struct { English string } -//ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json +// ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json var ISO693List = []ISO693Entry{ {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"}, {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"}, diff --git a/api/vendor/github.com/asaskevich/govalidator/validator.go b/api/vendor/github.com/asaskevich/govalidator/validator.go index 46ecfc84a4c6..110bb3cb3553 100644 --- a/api/vendor/github.com/asaskevich/govalidator/validator.go +++ b/api/vendor/github.com/asaskevich/govalidator/validator.go @@ -37,25 +37,32 @@ const rfc3339WithoutZone = "2006-01-02T15:04:05" // SetFieldsRequiredByDefault causes validation to fail when struct fields // do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). // This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter): -// type exampleStruct struct { -// Name string `` -// Email string `valid:"email"` +// +// type exampleStruct struct { +// Name string `` +// Email string `valid:"email"` +// // This, however, will only fail when Email is empty or an invalid email address: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email"` +// // Lastly, this will only fail when Email is an invalid email address but not when it's empty: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email,optional"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email,optional"` func SetFieldsRequiredByDefault(value bool) { fieldsRequiredByDefault = value } // SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required. // The validation will still reject ptr fields in their zero value state. Example with this enabled: -// type exampleStruct struct { -// Name *string `valid:"required"` +// +// type exampleStruct struct { +// Name *string `valid:"required"` +// // With `Name` set to "", this will be considered invalid input and will cause a validation error. // With `Name` set to nil, this will be considered valid by validation. // By default this is disabled. @@ -154,8 +161,8 @@ func IsAlpha(str string) bool { return rxAlpha.MatchString(str) } -//IsUTFLetter checks if the string contains only unicode letter characters. -//Similar to IsAlpha but for all languages. Empty string is valid. +// IsUTFLetter checks if the string contains only unicode letter characters. +// Similar to IsAlpha but for all languages. Empty string is valid. func IsUTFLetter(str string) bool { if IsNull(str) { return true @@ -398,8 +405,8 @@ const ulidEncodedSize = 26 // IsULID checks if the string is a ULID. // // Implementation got from: -// https://github.com/oklog/ulid (Apache-2.0 License) // +// https://github.com/oklog/ulid (Apache-2.0 License) func IsULID(str string) bool { // Check if a base32 encoded ULID is the right length. if len(str) != ulidEncodedSize { @@ -596,7 +603,7 @@ func IsFilePath(str string) (bool, int) { return false, Unknown } -//IsWinFilePath checks both relative & absolute paths in Windows +// IsWinFilePath checks both relative & absolute paths in Windows func IsWinFilePath(str string) bool { if rxARWinPath.MatchString(str) { //check windows path limit see: @@ -609,7 +616,7 @@ func IsWinFilePath(str string) bool { return false } -//IsUnixFilePath checks both relative & absolute paths in Unix +// IsUnixFilePath checks both relative & absolute paths in Unix func IsUnixFilePath(str string) bool { if rxARUnixPath.MatchString(str) { return true @@ -1001,7 +1008,8 @@ func ValidateArray(array []interface{}, iterator ConditionIterator) bool { // result will be equal to `false` if there are any errors. // s is the map containing the data to be validated. // m is the validation map in the form: -// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}} +// +// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}} func ValidateMap(s map[string]interface{}, m map[string]interface{}) (bool, error) { if s == nil { return true, nil diff --git a/api/vendor/github.com/beorn7/perks/quantile/stream.go b/api/vendor/github.com/beorn7/perks/quantile/stream.go index d7d14f8eb63d..593625434f2d 100644 --- a/api/vendor/github.com/beorn7/perks/quantile/stream.go +++ b/api/vendor/github.com/beorn7/perks/quantile/stream.go @@ -9,7 +9,7 @@ // // For more detailed information about the algorithm used, see: // -// Effective Computation of Biased Quantiles over Data Streams +// # Effective Computation of Biased Quantiles over Data Streams // // http://www.cs.rutgers.edu/~muthu/bquant.pdf package quantile diff --git a/api/vendor/github.com/davecgh/go-spew/spew/bypass.go b/api/vendor/github.com/davecgh/go-spew/spew/bypass.go index 792994785e36..70ddeaad3e56 100644 --- a/api/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/api/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -18,6 +18,7 @@ // tag is deprecated and thus should not be used. // Go versions prior to 1.4 are disabled because they use a different layout // for interfaces which make the implementation of unsafeReflectValue more complex. +//go:build !js && !appengine && !safe && !disableunsafe && go1.4 // +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew diff --git a/api/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/api/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 205c28d68c47..5e2d890d6ac8 100644 --- a/api/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/api/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -16,6 +16,7 @@ // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. +//go:build js || appengine || safe || disableunsafe || !go1.4 // +build js appengine safe disableunsafe !go1.4 package spew diff --git a/api/vendor/github.com/davecgh/go-spew/spew/config.go b/api/vendor/github.com/davecgh/go-spew/spew/config.go index 2e3d22f31202..161895fc6db8 100644 --- a/api/vendor/github.com/davecgh/go-spew/spew/config.go +++ b/api/vendor/github.com/davecgh/go-spew/spew/config.go @@ -254,15 +254,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by modifying the public members of c. See ConfigState for options documentation. @@ -295,12 +295,12 @@ func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) // NewDefaultConfig returns a ConfigState with the following default settings. // -// Indent: " " -// MaxDepth: 0 -// DisableMethods: false -// DisablePointerMethods: false -// ContinueOnMethod: false -// SortKeys: false +// Indent: " " +// MaxDepth: 0 +// DisableMethods: false +// DisablePointerMethods: false +// ContinueOnMethod: false +// SortKeys: false func NewDefaultConfig() *ConfigState { return &ConfigState{Indent: " "} } diff --git a/api/vendor/github.com/davecgh/go-spew/spew/doc.go b/api/vendor/github.com/davecgh/go-spew/spew/doc.go index aacaac6f1e1e..722e9aa7912c 100644 --- a/api/vendor/github.com/davecgh/go-spew/spew/doc.go +++ b/api/vendor/github.com/davecgh/go-spew/spew/doc.go @@ -21,35 +21,36 @@ debugging. A quick overview of the additional features spew provides over the built-in printing facilities for Go data types are as follows: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output (only when using - Dump style) + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output (only when using + Dump style) There are two different approaches spew allows for dumping Go data structures: - * Dump style which prints with newlines, customizable indentation, - and additional debug information such as types and all pointer addresses - used to indirect to the final value - * A custom Formatter interface that integrates cleanly with the standard fmt - package and replaces %v, %+v, %#v, and %#+v to provide inline printing - similar to the default %v while providing the additional functionality - outlined above and passing unsupported format verbs such as %x and %q - along to fmt + - Dump style which prints with newlines, customizable indentation, + and additional debug information such as types and all pointer addresses + used to indirect to the final value + - A custom Formatter interface that integrates cleanly with the standard fmt + package and replaces %v, %+v, %#v, and %#+v to provide inline printing + similar to the default %v while providing the additional functionality + outlined above and passing unsupported format verbs such as %x and %q + along to fmt -Quick Start +# Quick Start This section demonstrates how to quickly get started with spew. See the sections below for further details on formatting and configuration options. To dump a variable with full newlines, indentation, type, and pointer information use Dump, Fdump, or Sdump: + spew.Dump(myVar1, myVar2, ...) spew.Fdump(someWriter, myVar1, myVar2, ...) str := spew.Sdump(myVar1, myVar2, ...) @@ -58,12 +59,13 @@ Alternatively, if you would prefer to use format strings with a compacted inline printing style, use the convenience wrappers Printf, Fprintf, etc with %v (most compact), %+v (adds pointer addresses), %#v (adds types), or %#+v (adds types and pointer addresses): + spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2) spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4) -Configuration Options +# Configuration Options Configuration of spew is handled by fields in the ConfigState type. For convenience, all of the top-level functions use a global state available @@ -74,51 +76,52 @@ equivalent to the top-level functions. This allows concurrent configuration options. See the ConfigState documentation for more details. The following configuration options are available: - * Indent - String to use for each indentation level for Dump functions. - It is a single space by default. A popular alternative is "\t". - - * MaxDepth - Maximum number of levels to descend into nested data structures. - There is no limit by default. - - * DisableMethods - Disables invocation of error and Stringer interface methods. - Method invocation is enabled by default. - - * DisablePointerMethods - Disables invocation of error and Stringer interface methods on types - which only accept pointer receivers from non-pointer variables. - Pointer method invocation is enabled by default. - - * DisablePointerAddresses - DisablePointerAddresses specifies whether to disable the printing of - pointer addresses. This is useful when diffing data structures in tests. - - * DisableCapacities - DisableCapacities specifies whether to disable the printing of - capacities for arrays, slices, maps and channels. This is useful when - diffing data structures in tests. - - * ContinueOnMethod - Enables recursion into types after invoking error and Stringer interface - methods. Recursion after method invocation is disabled by default. - - * SortKeys - Specifies map keys should be sorted before being printed. Use - this to have a more deterministic, diffable output. Note that - only native types (bool, int, uint, floats, uintptr and string) - and types which implement error or Stringer interfaces are - supported with other types sorted according to the - reflect.Value.String() output which guarantees display - stability. Natural map order is used by default. - - * SpewKeys - Specifies that, as a last resort attempt, map keys should be - spewed to strings and sorted by those strings. This is only - considered if SortKeys is true. - -Dump Usage + + - Indent + String to use for each indentation level for Dump functions. + It is a single space by default. A popular alternative is "\t". + + - MaxDepth + Maximum number of levels to descend into nested data structures. + There is no limit by default. + + - DisableMethods + Disables invocation of error and Stringer interface methods. + Method invocation is enabled by default. + + - DisablePointerMethods + Disables invocation of error and Stringer interface methods on types + which only accept pointer receivers from non-pointer variables. + Pointer method invocation is enabled by default. + + - DisablePointerAddresses + DisablePointerAddresses specifies whether to disable the printing of + pointer addresses. This is useful when diffing data structures in tests. + + - DisableCapacities + DisableCapacities specifies whether to disable the printing of + capacities for arrays, slices, maps and channels. This is useful when + diffing data structures in tests. + + - ContinueOnMethod + Enables recursion into types after invoking error and Stringer interface + methods. Recursion after method invocation is disabled by default. + + - SortKeys + Specifies map keys should be sorted before being printed. Use + this to have a more deterministic, diffable output. Note that + only native types (bool, int, uint, floats, uintptr and string) + and types which implement error or Stringer interfaces are + supported with other types sorted according to the + reflect.Value.String() output which guarantees display + stability. Natural map order is used by default. + + - SpewKeys + Specifies that, as a last resort attempt, map keys should be + spewed to strings and sorted by those strings. This is only + considered if SortKeys is true. + +# Dump Usage Simply call spew.Dump with a list of variables you want to dump: @@ -133,7 +136,7 @@ A third option is to call spew.Sdump to get the formatted output as a string: str := spew.Sdump(myVar1, myVar2, ...) -Sample Dump Output +# Sample Dump Output See the Dump example for details on the setup of the types and variables being shown here. @@ -150,13 +153,14 @@ shown here. Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C command as shown. + ([]uint8) (len=32 cap=32) { 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... | 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0| 00000020 31 32 |12| } -Custom Formatter +# Custom Formatter Spew provides a custom formatter that implements the fmt.Formatter interface so that it integrates cleanly with standard fmt package printing functions. The @@ -170,7 +174,7 @@ standard fmt package for formatting. In addition, the custom formatter ignores the width and precision arguments (however they will still work on the format specifiers not handled by the custom formatter). -Custom Formatter Usage +# Custom Formatter Usage The simplest way to make use of the spew custom formatter is to call one of the convenience functions such as spew.Printf, spew.Println, or spew.Printf. The @@ -184,15 +188,17 @@ functions have syntax you are most likely already familiar with: See the Index for the full list convenience functions. -Sample Formatter Output +# Sample Formatter Output Double pointer to a uint8: + %v: <**>5 %+v: <**>(0xf8400420d0->0xf8400420c8)5 %#v: (**uint8)5 %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5 Pointer to circular struct with a uint8 field and a pointer to itself: + %v: <*>{1 <*>} %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)} %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)} @@ -201,7 +207,7 @@ Pointer to circular struct with a uint8 field and a pointer to itself: See the Printf example for details on the setup of variables being shown here. -Errors +# Errors Since it is possible for custom Stringer/error interfaces to panic, spew detects them and handles them internally by printing the panic information diff --git a/api/vendor/github.com/davecgh/go-spew/spew/dump.go b/api/vendor/github.com/davecgh/go-spew/spew/dump.go index f78d89fc1f6c..8323041a4811 100644 --- a/api/vendor/github.com/davecgh/go-spew/spew/dump.go +++ b/api/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -488,15 +488,15 @@ pointer addresses used to indirect to the final value. It provides the following features over the built-in printing facilities provided by the fmt package: - * Pointers are dereferenced and followed - * Circular data structures are detected and handled properly - * Custom Stringer/error interfaces are optionally invoked, including - on unexported types - * Custom types which only implement the Stringer/error interfaces via - a pointer receiver are optionally invoked when passing non-pointer - variables - * Byte arrays and slices are dumped like the hexdump -C command which - includes offsets, byte values in hex, and ASCII output + - Pointers are dereferenced and followed + - Circular data structures are detected and handled properly + - Custom Stringer/error interfaces are optionally invoked, including + on unexported types + - Custom types which only implement the Stringer/error interfaces via + a pointer receiver are optionally invoked when passing non-pointer + variables + - Byte arrays and slices are dumped like the hexdump -C command which + includes offsets, byte values in hex, and ASCII output The configuration options are controlled by an exported package global, spew.Config. See ConfigState for options documentation. diff --git a/api/vendor/github.com/emicklei/go-restful/v3/curly.go b/api/vendor/github.com/emicklei/go-restful/v3/curly.go index ba1fc5d5f15a..d7a27a9a87db 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/curly.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/curly.go @@ -72,7 +72,7 @@ func (c CurlyRouter) matchesRouteByPathTokens(routeTokens, requestTokens []strin return false, 0, 0 } requestToken := requestTokens[i] - if routeHasCustomVerb && hasCustomVerb(routeToken){ + if routeHasCustomVerb && hasCustomVerb(routeToken) { if !isMatchCustomVerb(routeToken, requestToken) { return false, 0, 0 } diff --git a/api/vendor/github.com/emicklei/go-restful/v3/doc.go b/api/vendor/github.com/emicklei/go-restful/v3/doc.go index 69b13057d017..5bdb9bb1864e 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/doc.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/doc.go @@ -1,7 +1,7 @@ /* Package restful , a lean package for creating REST-style WebServices without magic. -WebServices and Routes +# WebServices and Routes A WebService has a collection of Route objects that dispatch incoming Http Requests to a function calls. Typically, a WebService has a root path (e.g. /users) and defines common MIME types for its routes. @@ -30,14 +30,14 @@ The (*Request, *Response) arguments provide functions for reading information fr See the example https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go with a full implementation. -Regular expression matching Routes +# Regular expression matching Routes A Route parameter can be specified using the format "uri/{var[:regexp]}" or the special version "uri/{var:*}" for matching the tail of the path. For example, /persons/{name:[A-Z][A-Z]} can be used to restrict values for the parameter "name" to only contain capital alphabetic characters. Regular expressions must use the standard Go syntax as described in the regexp package. (https://code.google.com/p/re2/wiki/Syntax) This feature requires the use of a CurlyRouter. -Containers +# Containers A Container holds a collection of WebServices, Filters and a http.ServeMux for multiplexing http requests. Using the statements "restful.Add(...) and restful.Filter(...)" will register WebServices and Filters to the Default Container. @@ -47,7 +47,7 @@ You can create your own Container and create a new http.Server for that particul container := restful.NewContainer() server := &http.Server{Addr: ":8081", Handler: container} -Filters +# Filters A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. You can use filters to perform generic logging, measurement, authentication, redirect, set response headers etc. @@ -60,22 +60,21 @@ Use the following statement to pass the request,response pair to the next filter chain.ProcessFilter(req, resp) -Container Filters +# Container Filters These are processed before any registered WebService. // install a (global) filter for the default container (processed before any webservice) restful.Filter(globalLogging) -WebService Filters +# WebService Filters These are processed before any Route of a WebService. // install a webservice filter (processed before any route) ws.Filter(webserviceLogging).Filter(measureTime) - -Route Filters +# Route Filters These are processed before calling the function associated with the Route. @@ -84,7 +83,7 @@ These are processed before calling the function associated with the Route. See the example https://github.com/emicklei/go-restful/blob/v3/examples/filters/restful-filters.go with full implementations. -Response Encoding +# Response Encoding Two encodings are supported: gzip and deflate. To enable this for all responses: @@ -95,20 +94,20 @@ Alternatively, you can create a Filter that performs the encoding and install it See the example https://github.com/emicklei/go-restful/blob/v3/examples/encoding/restful-encoding-filter.go -OPTIONS support +# OPTIONS support By installing a pre-defined container filter, your Webservice(s) can respond to the OPTIONS Http request. Filter(OPTIONSFilter()) -CORS +# CORS By installing the filter of a CrossOriginResourceSharing (CORS), your WebService(s) can handle CORS requests. cors := CrossOriginResourceSharing{ExposeHeaders: []string{"X-My-Header"}, CookiesAllowed: false, Container: DefaultContainer} Filter(cors.Filter) -Error Handling +# Error Handling Unexpected things happen. If a request cannot be processed because of a failure, your service needs to tell via the response what happened and why. For this reason HTTP status codes exist and it is important to use the correct code in every exceptional situation. @@ -137,11 +136,11 @@ The request does not have or has an unknown Accept Header set for this operation The request does not have or has an unknown Content-Type Header set for this operation. -ServiceError +# ServiceError In addition to setting the correct (error) Http status code, you can choose to write a ServiceError message on the response. -Performance options +# Performance options This package has several options that affect the performance of your service. It is important to understand them and how you can change it. @@ -156,30 +155,27 @@ Default value is true If content encoding is enabled then the default strategy for getting new gzip/zlib writers and readers is to use a sync.Pool. Because writers are expensive structures, performance is even more improved when using a preloaded cache. You can also inject your own implementation. -Trouble shooting +# Trouble shooting This package has the means to produce detail logging of the complete Http request matching process and filter invocation. Enabling this feature requires you to set an implementation of restful.StdLogger (e.g. log.Logger) instance such as: restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) -Logging +# Logging The restful.SetLogger() method allows you to override the logger used by the package. By default restful uses the standard library `log` package and logs to stdout. Different logging packages are supported as long as they conform to `StdLogger` interface defined in the `log` sub-package, writing an adapter for your preferred package is simple. -Resources +# Resources -[project]: https://github.com/emicklei/go-restful +(c) 2012-2015, http://ernestmicklei.com. MIT License +[project]: https://github.com/emicklei/go-restful [examples]: https://github.com/emicklei/go-restful/blob/master/examples - -[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ - +[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ [showcases]: https://github.com/emicklei/mora, https://github.com/emicklei/landskape - -(c) 2012-2015, http://ernestmicklei.com. MIT License */ package restful diff --git a/api/vendor/github.com/emicklei/go-restful/v3/json.go b/api/vendor/github.com/emicklei/go-restful/v3/json.go index 871165166a16..23a83fb4095e 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/json.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/json.go @@ -1,3 +1,4 @@ +//go:build !jsoniter // +build !jsoniter package restful diff --git a/api/vendor/github.com/emicklei/go-restful/v3/jsoniter.go b/api/vendor/github.com/emicklei/go-restful/v3/jsoniter.go index 11b8f8ae7f17..ba9dd9abf07f 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/jsoniter.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/jsoniter.go @@ -1,3 +1,4 @@ +//go:build jsoniter // +build jsoniter package restful diff --git a/api/vendor/github.com/emicklei/go-restful/v3/response.go b/api/vendor/github.com/emicklei/go-restful/v3/response.go index a41a92cc2c35..09fb3c752814 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/response.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/response.go @@ -14,7 +14,7 @@ import ( // DefaultResponseMimeType is DEPRECATED, use DefaultResponseContentType(mime) var DefaultResponseMimeType string -//PrettyPrintResponses controls the indentation feature of XML and JSON serialization +// PrettyPrintResponses controls the indentation feature of XML and JSON serialization var PrettyPrintResponses = true // Response is a wrapper on the actual http ResponseWriter @@ -40,7 +40,8 @@ func NewResponse(httpWriter http.ResponseWriter) *Response { // If Accept header matching fails, fall back to this type. // Valid values are restful.MIME_JSON and restful.MIME_XML // Example: -// restful.DefaultResponseContentType(restful.MIME_JSON) +// +// restful.DefaultResponseContentType(restful.MIME_JSON) func DefaultResponseContentType(mime string) { DefaultResponseMimeType = mime } diff --git a/api/vendor/github.com/emicklei/go-restful/v3/web_service.go b/api/vendor/github.com/emicklei/go-restful/v3/web_service.go index 789c4df259fb..336a0bc2c96b 100644 --- a/api/vendor/github.com/emicklei/go-restful/v3/web_service.go +++ b/api/vendor/github.com/emicklei/go-restful/v3/web_service.go @@ -188,20 +188,20 @@ func (w *WebService) Route(builder *RouteBuilder) *WebService { // RemoveRoute removes the specified route, looks for something that matches 'path' and 'method' func (w *WebService) RemoveRoute(path, method string) error { - if !w.dynamicRoutes { - return errors.New("dynamic routes are not enabled.") - } - w.routesLock.Lock() - defer w.routesLock.Unlock() - newRoutes := []Route{} - for _, route := range w.routes { - if route.Method == method && route.Path == path { - continue - } - newRoutes = append(newRoutes, route) - } - w.routes = newRoutes - return nil + if !w.dynamicRoutes { + return errors.New("dynamic routes are not enabled.") + } + w.routesLock.Lock() + defer w.routesLock.Unlock() + newRoutes := []Route{} + for _, route := range w.routes { + if route.Method == method && route.Path == path { + continue + } + newRoutes = append(newRoutes, route) + } + w.routes = newRoutes + return nil } // Method creates a new RouteBuilder and initialize its http method diff --git a/api/vendor/github.com/go-openapi/analysis/doc.go b/api/vendor/github.com/go-openapi/analysis/doc.go index d5294c0950b6..a00fe776f537 100644 --- a/api/vendor/github.com/go-openapi/analysis/doc.go +++ b/api/vendor/github.com/go-openapi/analysis/doc.go @@ -16,27 +16,27 @@ Package analysis provides methods to work with a Swagger specification document from package go-openapi/spec. -Analyzing a specification +# Analyzing a specification An analysed specification object (type Spec) provides methods to work with swagger definition. -Flattening or expanding a specification +# Flattening or expanding a specification Flattening a specification bundles all remote $ref in the main spec document. Depending on flattening options, additional preprocessing may take place: - full flattening: replacing all inline complex constructs by a named entry in #/definitions - expand: replace all $ref's in the document by their expanded content -Merging several specifications +# Merging several specifications Mixin several specifications merges all Swagger constructs, and warns about found conflicts. -Fixing a specification +# Fixing a specification Unmarshalling a specification with golang json unmarshalling may lead to some unwanted result on present but empty fields. -Analyzing a Swagger schema +# Analyzing a Swagger schema Swagger schemas are analyzed to determine their complexity and qualify their content. */ diff --git a/api/vendor/github.com/go-openapi/analysis/flatten.go b/api/vendor/github.com/go-openapi/analysis/flatten.go index 0576220fb3d7..ecf7e36d6151 100644 --- a/api/vendor/github.com/go-openapi/analysis/flatten.go +++ b/api/vendor/github.com/go-openapi/analysis/flatten.go @@ -62,28 +62,26 @@ func newContext() *context { // // There is a minimal and a full flattening mode. // -// // Minimally flattening a spec means: -// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left -// unscathed) -// - Importing external (http, file) references so they become internal to the document -// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers -// like "$ref": "#/definitions/myObject/allOfs/1") +// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left +// unscathed) +// - Importing external (http, file) references so they become internal to the document +// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers +// like "$ref": "#/definitions/myObject/allOfs/1") // // A minimally flattened spec thus guarantees the following properties: -// - all $refs point to a local definition (i.e. '#/definitions/...') -// - definitions are unique +// - all $refs point to a local definition (i.e. '#/definitions/...') +// - definitions are unique // // NOTE: arbitrary JSON pointers (other than $refs to top level definitions) are rewritten as definitions if they // represent a complex schema or express commonality in the spec. // Otherwise, they are simply expanded. // Self-referencing JSON pointers cannot resolve to a type and trigger an error. // -// // Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. // // Fully flattening a spec means: -// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. +// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. // // By complex, we mean every JSON object with some properties. // Arrays, when they do not define a tuple, @@ -93,22 +91,21 @@ func newContext() *context { // have been created. // // Available flattening options: -// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched -// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) -// - Verbose: croaks about name conflicts detected -// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening +// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched +// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) +// - Verbose: croaks about name conflicts detected +// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening // // NOTE: expansion removes all $ref save circular $ref, which remain in place // // TODO: additional options -// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a -// x-go-name extension -// - LiftAllOfs: -// - limit the flattening of allOf members when simple objects -// - merge allOf with validation only -// - merge allOf with extensions only -// - ... -// +// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a +// x-go-name extension +// - LiftAllOfs: +// - limit the flattening of allOf members when simple objects +// - merge allOf with validation only +// - merge allOf with extensions only +// - ... func Flatten(opts FlattenOpts) error { debugLog("FlattenOpts: %#v", opts) @@ -488,9 +485,9 @@ func stripPointersAndOAIGen(opts *FlattenOpts) error { // stripOAIGen strips the spec from unnecessary OAIGen constructs, initially created to dedupe flattened definitions. // // A dedupe is deemed unnecessary whenever: -// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) -// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to -// the first parent. +// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) +// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to +// the first parent. // // This function returns true whenever it re-inlined a complex schema, so the caller may chose to iterate // pointer and name resolution again. diff --git a/api/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go b/api/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go index 26c2a05a3101..545483bd624c 100644 --- a/api/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go +++ b/api/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go @@ -318,8 +318,8 @@ type DeepestRefResult struct { } // DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. -// - if no definition is found, returns the deepest ref. -// - pointers to external files are expanded +// - if no definition is found, returns the deepest ref. +// - pointers to external files are expanded // // NOTE: all external $ref's are assumed to be already expanded at this stage. func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { diff --git a/api/vendor/github.com/go-openapi/analysis/schema.go b/api/vendor/github.com/go-openapi/analysis/schema.go index fc055095cbb6..95f35dc756a3 100644 --- a/api/vendor/github.com/go-openapi/analysis/schema.go +++ b/api/vendor/github.com/go-openapi/analysis/schema.go @@ -247,10 +247,10 @@ func (a *AnalyzedSchema) isArrayType() bool { // isAnalyzedAsComplex determines if an analyzed schema is eligible to flattening (i.e. it is "complex"). // // Complex means the schema is any of: -// - a simple type (primitive) -// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) -// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will -// generate a definition) +// - a simple type (primitive) +// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) +// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will +// generate a definition) func (a *AnalyzedSchema) isAnalyzedAsComplex() bool { return !a.IsSimpleSchema && !a.IsArray && !a.IsMap } diff --git a/api/vendor/github.com/go-openapi/loads/doc.go b/api/vendor/github.com/go-openapi/loads/doc.go index 3046da4cef39..f5d549039c1b 100644 --- a/api/vendor/github.com/go-openapi/loads/doc.go +++ b/api/vendor/github.com/go-openapi/loads/doc.go @@ -16,6 +16,5 @@ Package loads provides document loading methods for swagger (OAI) specifications. It is used by other go-openapi packages to load and run analysis on local or remote spec documents. - */ package loads diff --git a/api/vendor/github.com/go-openapi/loads/loaders.go b/api/vendor/github.com/go-openapi/loads/loaders.go index 44bd32b5b887..f6b50d775381 100644 --- a/api/vendor/github.com/go-openapi/loads/loaders.go +++ b/api/vendor/github.com/go-openapi/loads/loaders.go @@ -118,9 +118,8 @@ func JSONDoc(path string) (json.RawMessage, error) { // This sets the configuration at the package level. // // NOTE: -// * this updates the default loader used by github.com/go-openapi/spec -// * since this sets package level globals, you shouln't call this concurrently -// +// - this updates the default loader used by github.com/go-openapi/spec +// - since this sets package level globals, you shouln't call this concurrently func AddLoader(predicate DocMatcher, load DocLoader) { loaders = loaders.WithHead(&loader{ DocLoaderWithMatch: DocLoaderWithMatch{ diff --git a/api/vendor/github.com/go-openapi/spec/bindata.go b/api/vendor/github.com/go-openapi/spec/bindata.go index afc83850c2e8..4363ab87a5ee 100644 --- a/api/vendor/github.com/go-openapi/spec/bindata.go +++ b/api/vendor/github.com/go-openapi/spec/bindata.go @@ -210,11 +210,13 @@ var _bindata = map[string]func() (*asset, error){ // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +// // then AssetDir("data") would return []string{"foo.txt", "img"}, // AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and diff --git a/api/vendor/github.com/go-openapi/spec/expander.go b/api/vendor/github.com/go-openapi/spec/expander.go index d4ea889d44d5..012a4627cc45 100644 --- a/api/vendor/github.com/go-openapi/spec/expander.go +++ b/api/vendor/github.com/go-openapi/spec/expander.go @@ -27,7 +27,6 @@ import ( // all relative $ref's will be resolved from there. // // PathLoader injects a document loading method. By default, this resolves to the function provided by the SpecLoader package variable. -// type ExpandOptions struct { RelativeBase string // the path to the root document to expand. This is a file, not a directory SkipSchemas bool // do not expand schemas, just paths, parameters and responses diff --git a/api/vendor/github.com/go-openapi/spec/parameter.go b/api/vendor/github.com/go-openapi/spec/parameter.go index 2b2b89b67bf3..bd4f1cdb0760 100644 --- a/api/vendor/github.com/go-openapi/spec/parameter.go +++ b/api/vendor/github.com/go-openapi/spec/parameter.go @@ -84,27 +84,27 @@ type ParamProps struct { // Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). // // There are five possible parameter types. -// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part -// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, -// the path parameter is `itemId`. -// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. -// * Header - Custom headers that are expected as part of the request. -// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be -// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for -// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist -// together for the same operation. -// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or -// `multipart/form-data` are used as the content type of the request (in Swagger's definition, -// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used -// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be -// declared together with a body parameter for the same operation. Form parameters have a different format based on -// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). -// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. -// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple -// parameters that are being transferred. -// * `multipart/form-data` - each parameter takes a section in the payload with an internal header. -// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is -// `submit-name`. This type of form parameters is more commonly used for file transfers. +// - Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part +// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, +// the path parameter is `itemId`. +// - Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +// - Header - Custom headers that are expected as part of the request. +// - Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be +// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for +// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist +// together for the same operation. +// - Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or +// `multipart/form-data` are used as the content type of the request (in Swagger's definition, +// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used +// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be +// declared together with a body parameter for the same operation. Form parameters have a different format based on +// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). +// - `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. +// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple +// parameters that are being transferred. +// - `multipart/form-data` - each parameter takes a section in the payload with an internal header. +// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is +// `submit-name`. This type of form parameters is more commonly used for file transfers. // // For more information: http://goo.gl/8us55a#parameterObject type Parameter struct { diff --git a/api/vendor/github.com/go-openapi/strfmt/ulid.go b/api/vendor/github.com/go-openapi/strfmt/ulid.go index 4bd2ccd8f66d..6afaa2dc05cf 100644 --- a/api/vendor/github.com/go-openapi/strfmt/ulid.go +++ b/api/vendor/github.com/go-openapi/strfmt/ulid.go @@ -15,9 +15,12 @@ import ( // ULID represents a ulid string format // ref: -// https://github.com/ulid/spec +// +// https://github.com/ulid/spec +// // impl: -// https://github.com/oklog/ulid +// +// https://github.com/oklog/ulid // // swagger:strfmt ulid type ULID struct { diff --git a/api/vendor/github.com/go-openapi/validate/doc.go b/api/vendor/github.com/go-openapi/validate/doc.go index f5ca9a5d580c..351032c4c521 100644 --- a/api/vendor/github.com/go-openapi/validate/doc.go +++ b/api/vendor/github.com/go-openapi/validate/doc.go @@ -19,7 +19,7 @@ as well as tools to validate data against their schema. This package follows Swagger 2.0. specification (aka OpenAPI 2.0). Reference can be found here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md. -Validating a specification +# Validating a specification Validates a spec document (from JSON or YAML) against the JSON schema for swagger, then checks a number of extra rules that can't be expressed in JSON schema. @@ -30,34 +30,36 @@ Entry points: - SpecValidator.Validate() Reported as errors: - [x] definition can't declare a property that's already defined by one of its ancestors - [x] definition's ancestor can't be a descendant of the same model - [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method - [x] each security reference should contain only unique scopes - [x] each security scope in a security definition should be unique - [x] parameters in path must be unique - [x] each path parameter must correspond to a parameter placeholder and vice versa - [x] each referenceable definition must have references - [x] each definition property listed in the required array must be defined in the properties of the model - [x] each parameter should have a unique `name` and `type` combination - [x] each operation should have only 1 parameter of type body - [x] each reference must point to a valid object - [x] every default value that is specified must validate against the schema for that property - [x] items property is required for all schemas/definitions of type `array` - [x] path parameters must be declared a required - [x] headers must not contain $ref - [x] schema and property examples provided must validate against their respective object's schema - [x] examples provided must validate their schema + + [x] definition can't declare a property that's already defined by one of its ancestors + [x] definition's ancestor can't be a descendant of the same model + [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method + [x] each security reference should contain only unique scopes + [x] each security scope in a security definition should be unique + [x] parameters in path must be unique + [x] each path parameter must correspond to a parameter placeholder and vice versa + [x] each referenceable definition must have references + [x] each definition property listed in the required array must be defined in the properties of the model + [x] each parameter should have a unique `name` and `type` combination + [x] each operation should have only 1 parameter of type body + [x] each reference must point to a valid object + [x] every default value that is specified must validate against the schema for that property + [x] items property is required for all schemas/definitions of type `array` + [x] path parameters must be declared a required + [x] headers must not contain $ref + [x] schema and property examples provided must validate against their respective object's schema + [x] examples provided must validate their schema Reported as warnings: - [x] path parameters should not contain any of [{,},\w] - [x] empty path - [x] unused definitions - [x] unsupported validation of examples on non-JSON media types - [x] examples in response without schema - [x] readOnly properties should not be required -Validating a schema + [x] path parameters should not contain any of [{,},\w] + [x] empty path + [x] unused definitions + [x] unsupported validation of examples on non-JSON media types + [x] examples in response without schema + [x] readOnly properties should not be required + +# Validating a schema The schema validation toolkit validates data against JSON-schema-draft 04 schema. @@ -70,16 +72,16 @@ Entry points: - AgainstSchema() - ... -Known limitations +# Known limitations With the current version of this package, the following aspects of swagger are not yet supported: - [ ] errors and warnings are not reported with key/line number in spec - [ ] default values and examples on responses only support application/json producer type - [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values - [ ] rules for collectionFormat are not implemented - [ ] no validation rule for polymorphism support (discriminator) [not done here] - [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid - [ ] arbitrary large numbers are not supported: max is math.MaxFloat64 + [ ] errors and warnings are not reported with key/line number in spec + [ ] default values and examples on responses only support application/json producer type + [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values + [ ] rules for collectionFormat are not implemented + [ ] no validation rule for polymorphism support (discriminator) [not done here] + [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid + [ ] arbitrary large numbers are not supported: max is math.MaxFloat64 */ package validate diff --git a/api/vendor/github.com/go-openapi/validate/example_validator.go b/api/vendor/github.com/go-openapi/validate/example_validator.go index c8bffd78e5ae..930b47e53009 100644 --- a/api/vendor/github.com/go-openapi/validate/example_validator.go +++ b/api/vendor/github.com/go-openapi/validate/example_validator.go @@ -48,7 +48,6 @@ func (ex *exampleValidator) isVisited(path string) bool { // - schemas // - individual property // - responses -// func (ex *exampleValidator) Validate() (errs *Result) { errs = new(Result) if ex == nil || ex.SpecValidator == nil { diff --git a/api/vendor/github.com/go-openapi/validate/spec.go b/api/vendor/github.com/go-openapi/validate/spec.go index dff01f00be73..47f291e6c39d 100644 --- a/api/vendor/github.com/go-openapi/validate/spec.go +++ b/api/vendor/github.com/go-openapi/validate/spec.go @@ -32,17 +32,16 @@ import ( // // Returns an error flattening in a single standard error, all validation messages. // -// - TODO: $ref should not have siblings -// - TODO: make sure documentation reflects all checks and warnings -// - TODO: check on discriminators -// - TODO: explicit message on unsupported keywords (better than "forbidden property"...) -// - TODO: full list of unresolved refs -// - TODO: validate numeric constraints (issue#581): this should be handled like defaults and examples -// - TODO: option to determine if we validate for go-swagger or in a more general context -// - TODO: check on required properties to support anyOf, allOf, oneOf +// - TODO: $ref should not have siblings +// - TODO: make sure documentation reflects all checks and warnings +// - TODO: check on discriminators +// - TODO: explicit message on unsupported keywords (better than "forbidden property"...) +// - TODO: full list of unresolved refs +// - TODO: validate numeric constraints (issue#581): this should be handled like defaults and examples +// - TODO: option to determine if we validate for go-swagger or in a more general context +// - TODO: check on required properties to support anyOf, allOf, oneOf // // NOTE: SecurityScopes are maps: no need to check uniqueness -// func Spec(doc *loads.Document, formats strfmt.Registry) error { errs, _ /*warns*/ := NewSpecValidator(doc.Schema(), formats).Validate(doc) if errs.HasErrors() { diff --git a/api/vendor/github.com/go-openapi/validate/spec_messages.go b/api/vendor/github.com/go-openapi/validate/spec_messages.go index b3757adddbd3..5398679bffef 100644 --- a/api/vendor/github.com/go-openapi/validate/spec_messages.go +++ b/api/vendor/github.com/go-openapi/validate/spec_messages.go @@ -349,9 +349,10 @@ func parameterValidationTypeMismatchMsg(param, path, typ string) errors.Error { } // disabled -// func invalidResponseDefinitionAsSchemaMsg(path, method string) errors.Error { -// return errors.New(errors.CompositeErrorCode, InvalidResponseDefinitionAsSchemaError, path, method) -// } +// +// func invalidResponseDefinitionAsSchemaMsg(path, method string) errors.Error { +// return errors.New(errors.CompositeErrorCode, InvalidResponseDefinitionAsSchemaError, path, method) +// } func someParametersBrokenMsg(path, method, operationID string) errors.Error { return errors.New(errors.CompositeErrorCode, SomeParametersBrokenError, path, method, operationID) } diff --git a/api/vendor/github.com/gogo/protobuf/proto/lib.go b/api/vendor/github.com/gogo/protobuf/proto/lib.go index 80db1c155b59..10eec0d0ee52 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/lib.go +++ b/api/vendor/github.com/gogo/protobuf/proto/lib.go @@ -39,35 +39,35 @@ for a protocol buffer variable v: - Names are turned from camel_case to CamelCase for export. - There are no methods on v to set fields; just treat - them as structure fields. + them as structure fields. - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. + and return the field's default value if unset. + The getters work even if the receiver is a nil message. - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. + All desired fields must be set before marshaling. - A Reset() method will restore a protobuf struct to its zero state. - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. + That is, optional or required field int32 f becomes F *int32. - Repeated fields are slices. - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field + msg.Foo = proto.String("hello") // set field - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. + have them. They have the form Default_StructName_FieldName. + Because the getter methods handle defaulted values, + direct use of these constants should be rare. - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. + Enum values are prefixed by the enclosing message's name, or by the + enum's type name if it is a top-level enum. Enum types have a String + method, and a Enum method to assist in message construction. - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. + the surrounding message type. - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. + followed by an underscore-delimited list of the nested messages + that contain it (if any) followed by the CamelCased name of the + extension field itself. HasExtension, ClearExtension, GetExtension + and SetExtension are functions for manipulating extensions. - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. + with distinguished wrapper types for each possible field value. - Marshal and Unmarshal are functions to encode and decode the wire format. When the .proto file specifies `syntax="proto3"`, there are some differences: diff --git a/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go b/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go index b6cad90834b3..461d58218aff 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go +++ b/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -29,6 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//go:build purego || appengine || js // +build purego appengine js // This file contains an implementation of proto field accesses using package reflect. diff --git a/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go index 7ffd3c29d90c..d6e07e2f7193 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go +++ b/api/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -26,6 +26,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//go:build purego || appengine || js // +build purego appengine js // This file contains an implementation of proto field accesses using package reflect. diff --git a/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go index d55a335d9453..c998399ba71f 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ b/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -29,6 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//go:build !purego && !appengine && !js // +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. diff --git a/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go index aca8eed02a11..57a1496565fb 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ b/api/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -26,6 +26,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//go:build !purego && !appengine && !js // +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. diff --git a/api/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go b/api/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go index 937229386a27..7c3e9e000ee7 100644 --- a/api/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go +++ b/api/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go @@ -2004,12 +2004,14 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler { // makeUnmarshalOneof makes an unmarshaler for oneof fields. // for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } +// +// message Msg { +// oneof F { +// int64 X = 1; +// float64 Y = 2; +// } +// } +// // typ is the type of the concrete entry for a oneof case (e.g. Msg_X). // ityp is the interface type of the oneof field (e.g. isMsg_F). // unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). diff --git a/api/vendor/github.com/google/gnostic-models/jsonschema/base.go b/api/vendor/github.com/google/gnostic-models/jsonschema/base.go index 5fcc4885a03c..a01b1b0d633c 100644 --- a/api/vendor/github.com/google/gnostic-models/jsonschema/base.go +++ b/api/vendor/github.com/google/gnostic-models/jsonschema/base.go @@ -20,9 +20,9 @@ import ( "encoding/base64" ) -func baseSchemaBytes() ([]byte, error){ +func baseSchemaBytes() ([]byte, error) { return base64.StdEncoding.DecodeString( -`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi + `ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg @@ -94,4 +94,5 @@ YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5 IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6 IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1 -c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)} +c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`) +} diff --git a/api/vendor/github.com/google/gofuzz/fuzz.go b/api/vendor/github.com/google/gofuzz/fuzz.go index 761520a8ceeb..51d6ece77faa 100644 --- a/api/vendor/github.com/google/gofuzz/fuzz.go +++ b/api/vendor/github.com/google/gofuzz/fuzz.go @@ -82,12 +82,13 @@ func NewWithSeed(seed int64) *Fuzzer { // // +build gofuzz // package mypacakge // import fuzz "github.com/google/gofuzz" -// func Fuzz(data []byte) int { -// var i int -// fuzz.NewFromGoFuzz(data).Fuzz(&i) -// MyFunc(i) -// return 0 -// } +// +// func Fuzz(data []byte) int { +// var i int +// fuzz.NewFromGoFuzz(data).Fuzz(&i) +// MyFunc(i) +// return 0 +// } func NewFromGoFuzz(data []byte) *Fuzzer { return New().RandSource(bytesource.New(data)) } diff --git a/api/vendor/github.com/google/uuid/dce.go b/api/vendor/github.com/google/uuid/dce.go index fa820b9d3092..9302a1c1bb5b 100644 --- a/api/vendor/github.com/google/uuid/dce.go +++ b/api/vendor/github.com/google/uuid/dce.go @@ -42,7 +42,7 @@ func NewDCESecurity(domain Domain, id uint32) (UUID, error) { // NewDCEPerson returns a DCE Security (Version 2) UUID in the person // domain with the id returned by os.Getuid. // -// NewDCESecurity(Person, uint32(os.Getuid())) +// NewDCESecurity(Person, uint32(os.Getuid())) func NewDCEPerson() (UUID, error) { return NewDCESecurity(Person, uint32(os.Getuid())) } @@ -50,7 +50,7 @@ func NewDCEPerson() (UUID, error) { // NewDCEGroup returns a DCE Security (Version 2) UUID in the group // domain with the id returned by os.Getgid. // -// NewDCESecurity(Group, uint32(os.Getgid())) +// NewDCESecurity(Group, uint32(os.Getgid())) func NewDCEGroup() (UUID, error) { return NewDCESecurity(Group, uint32(os.Getgid())) } diff --git a/api/vendor/github.com/google/uuid/hash.go b/api/vendor/github.com/google/uuid/hash.go index b404f4bec274..24ccde646490 100644 --- a/api/vendor/github.com/google/uuid/hash.go +++ b/api/vendor/github.com/google/uuid/hash.go @@ -39,7 +39,7 @@ func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { // NewMD5 returns a new MD5 (Version 3) UUID based on the // supplied name space and data. It is the same as calling: // -// NewHash(md5.New(), space, data, 3) +// NewHash(md5.New(), space, data, 3) func NewMD5(space UUID, data []byte) UUID { return NewHash(md5.New(), space, data, 3) } @@ -47,7 +47,7 @@ func NewMD5(space UUID, data []byte) UUID { // NewSHA1 returns a new SHA1 (Version 5) UUID based on the // supplied name space and data. It is the same as calling: // -// NewHash(sha1.New(), space, data, 5) +// NewHash(sha1.New(), space, data, 5) func NewSHA1(space UUID, data []byte) UUID { return NewHash(sha1.New(), space, data, 5) } diff --git a/api/vendor/github.com/google/uuid/node_js.go b/api/vendor/github.com/google/uuid/node_js.go index 24b78edc9071..96090351a901 100644 --- a/api/vendor/github.com/google/uuid/node_js.go +++ b/api/vendor/github.com/google/uuid/node_js.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build js // +build js package uuid diff --git a/api/vendor/github.com/google/uuid/node_net.go b/api/vendor/github.com/google/uuid/node_net.go index 0cbbcddbd6e8..e91358f7d9e3 100644 --- a/api/vendor/github.com/google/uuid/node_net.go +++ b/api/vendor/github.com/google/uuid/node_net.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !js // +build !js package uuid diff --git a/api/vendor/github.com/google/uuid/null.go b/api/vendor/github.com/google/uuid/null.go index d7fcbf286516..06ecf9de2af6 100644 --- a/api/vendor/github.com/google/uuid/null.go +++ b/api/vendor/github.com/google/uuid/null.go @@ -17,15 +17,14 @@ var jsonNull = []byte("null") // NullUUID implements the SQL driver.Scanner interface so // it can be used as a scan destination: // -// var u uuid.NullUUID -// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) -// ... -// if u.Valid { -// // use u.UUID -// } else { -// // NULL value -// } -// +// var u uuid.NullUUID +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) +// ... +// if u.Valid { +// // use u.UUID +// } else { +// // NULL value +// } type NullUUID struct { UUID UUID Valid bool // Valid is true if UUID is not NULL diff --git a/api/vendor/github.com/google/uuid/version4.go b/api/vendor/github.com/google/uuid/version4.go index 7697802e4d16..62ac273815ca 100644 --- a/api/vendor/github.com/google/uuid/version4.go +++ b/api/vendor/github.com/google/uuid/version4.go @@ -9,7 +9,7 @@ import "io" // New creates a new random UUID or panics. New is equivalent to // the expression // -// uuid.Must(uuid.NewRandom()) +// uuid.Must(uuid.NewRandom()) func New() UUID { return Must(NewRandom()) } @@ -17,7 +17,7 @@ func New() UUID { // NewString creates a new random UUID and returns it as a string or panics. // NewString is equivalent to the expression // -// uuid.New().String() +// uuid.New().String() func NewString() string { return Must(NewRandom()).String() } @@ -31,11 +31,11 @@ func NewString() string { // // A note about uniqueness derived from the UUID Wikipedia entry: // -// Randomly generated UUIDs have 122 random bits. One's annual risk of being -// hit by a meteorite is estimated to be one chance in 17 billion, that -// means the probability is about 0.00000000006 (6 × 10−11), -// equivalent to the odds of creating a few tens of trillions of UUIDs in a -// year and having one duplicate. +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. func NewRandom() (UUID, error) { if !poolEnabled { return NewRandomFromReader(rander) diff --git a/api/vendor/github.com/imdario/mergo/doc.go b/api/vendor/github.com/imdario/mergo/doc.go index fcd985f995dc..6c8fb45d41b7 100644 --- a/api/vendor/github.com/imdario/mergo/doc.go +++ b/api/vendor/github.com/imdario/mergo/doc.go @@ -8,11 +8,11 @@ A helper to merge structs and maps in Golang. Useful for configuration default v Mergo merges same-type structs and maps by setting default values in zero-value fields. Mergo won't merge unexported (private) fields. It will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection). -Status +# Status It is ready for production use. It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc. -Important note +# Important note Please keep in mind that a problematic PR broke 0.3.9. We reverted it in 0.3.10. We consider 0.3.10 as stable but not bug-free. . Also, this version adds suppot for go modules. @@ -20,18 +20,18 @@ Keep in mind that in 0.3.2, Mergo changed Merge() and Map() signatures to suppor If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with go get -u github.com/imdario/mergo. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). -Install +# Install Do your usual installation procedure: - go get github.com/imdario/mergo + go get github.com/imdario/mergo - // use in your .go code - import ( - "github.com/imdario/mergo" - ) + // use in your .go code + import ( + "github.com/imdario/mergo" + ) -Usage +# Usage You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as they are zero values too. Also, maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection). @@ -81,7 +81,7 @@ Here is a nice example: // {two 2} } -Transformers +# Transformers Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, time.Time is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero time.Time? @@ -127,17 +127,16 @@ Transformers allow to merge specific types differently than in the default behav // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 } } -Contact me +# Contact me If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): https://twitter.com/im_dario -About +# About Written by Dario Castañé: https://da.rio.hn -License +# License BSD 3-Clause license, as Go language. - */ package mergo diff --git a/api/vendor/github.com/itchyny/gojq/builtin.go b/api/vendor/github.com/itchyny/gojq/builtin.go index a59795d458d9..3b0b8a11bf3c 100644 --- a/api/vendor/github.com/itchyny/gojq/builtin.go +++ b/api/vendor/github.com/itchyny/gojq/builtin.go @@ -4,67 +4,67 @@ package gojq func init() { builtinFuncDefs = map[string][]*FuncDef{ - "IN": []*FuncDef{&FuncDef{Name: "IN", Args: []string{"s"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Left: &Query{Func: "s"}, Op: OpEq, Right: &Query{Func: "."}}, &Query{Func: "."}}}}}}, &FuncDef{Name: "IN", Args: []string{"src", "s"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Left: &Query{Func: "src"}, Op: OpEq, Right: &Query{Func: "s"}}, &Query{Func: "."}}}}}}}, - "INDEX": []*FuncDef{&FuncDef{Name: "INDEX", Args: []string{"stream", "idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "stream"}}, Pattern: &Pattern{Name: "$row"}, Start: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{}}}, Update: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Left: &Query{Func: "$row"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "idx_expr"}, Op: OpPipe, Right: &Query{Func: "tostring"}}}}}}, Op: OpAssign, Right: &Query{Func: "$row"}}}}}}, &FuncDef{Name: "INDEX", Args: []string{"idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "INDEX", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "idx_expr"}}}}}}}, - "JOIN": []*FuncDef{&FuncDef{Name: "JOIN", Args: []string{"$idx", "idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}}}}}}, &FuncDef{Name: "JOIN", Args: []string{"$idx", "stream", "idx_expr"}, Body: &Query{Left: &Query{Func: "stream"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}}}, &FuncDef{Name: "JOIN", Args: []string{"$idx", "stream", "idx_expr", "join_expr"}, Body: &Query{Left: &Query{Func: "stream"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "join_expr"}}}}}, - "_assign": []*FuncDef{&FuncDef{Name: "_assign", Args: []string{"ps", "$v"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "ps"}}}}, Pattern: &Pattern{Name: "$p"}, Start: &Query{Func: "."}, Update: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Func: "$p"}, &Query{Func: "$v"}}}}}}}}}}, - "_modify": []*FuncDef{&FuncDef{Name: "_modify", Args: []string{"ps", "f"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "ps"}}}}, Pattern: &Pattern{Name: "$p"}, Start: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}}}}}, Update: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}, Op: OpAdd, Right: &Query{Func: "$p"}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$q"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Func: "$q"}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$q"}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}}}}}}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "$p"}}}}}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$x"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "delpaths", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$x"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}}}}}}}}}, - "all": []*FuncDef{&FuncDef{Name: "all", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "all", Args: []*Query{&Query{Func: "."}}}}}}, &FuncDef{Name: "all", Args: []string{"y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "all", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "y"}}}}}}, &FuncDef{Name: "all", Args: []string{"g", "y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "isempty", Args: []*Query{&Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "y"}, Op: OpPipe, Right: &Query{Func: "not"}}}}}}}}}}}}}, - "any": []*FuncDef{&FuncDef{Name: "any", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Func: "."}}}}}}, &FuncDef{Name: "any", Args: []string{"y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "y"}}}}}}, &FuncDef{Name: "any", Args: []string{"g", "y"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "isempty", Args: []*Query{&Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "y"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "not"}}}}, - "arrays": []*FuncDef{&FuncDef{Name: "arrays", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}}}}}}}, - "ascii_downcase": []*FuncDef{&FuncDef{Name: "ascii_downcase", Body: &Query{Left: &Query{Func: "explode"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeNumber, Number: "65"}}, Op: OpLe, Right: &Query{Func: "."}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "90"}}}}, Then: &Query{Left: &Query{Func: "."}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "32"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "implode"}}}}}, - "ascii_upcase": []*FuncDef{&FuncDef{Name: "ascii_upcase", Body: &Query{Left: &Query{Func: "explode"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeNumber, Number: "97"}}, Op: OpLe, Right: &Query{Func: "."}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "122"}}}}, Then: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "32"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "implode"}}}}}, - "booleans": []*FuncDef{&FuncDef{Name: "booleans", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "boolean"}}}}}}}}}}, - "capture": []*FuncDef{&FuncDef{Name: "capture", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "capture", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "capture", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}, Op: OpPipe, Right: &Query{Func: "_capture"}}}}, - "combinations": []*FuncDef{&FuncDef{Name: "combinations", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}, Else: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "$x"}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}, IsSlice: true}}}, Op: OpPipe, Right: &Query{Func: "combinations"}}}}}}}}}}}}}}, &FuncDef{Name: "combinations", Args: []string{"n"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "limit", Args: []*Query{&Query{Func: "n"}, &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "repeat", Args: []*Query{&Query{Func: "."}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "combinations"}}}}, - "del": []*FuncDef{&FuncDef{Name: "del", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "delpaths", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "f"}}}}}}}}}}}}}}, - "finites": []*FuncDef{&FuncDef{Name: "finites", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "isfinite"}}}}}}}, - "first": []*FuncDef{&FuncDef{Name: "first", Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}, &FuncDef{Name: "first", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}}}}, - "fromdate": []*FuncDef{&FuncDef{Name: "fromdate", Body: &Query{Func: "fromdateiso8601"}}}, + "IN": []*FuncDef{&FuncDef{Name: "IN", Args: []string{"s"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Left: &Query{Func: "s"}, Op: OpEq, Right: &Query{Func: "."}}, &Query{Func: "."}}}}}}, &FuncDef{Name: "IN", Args: []string{"src", "s"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Left: &Query{Func: "src"}, Op: OpEq, Right: &Query{Func: "s"}}, &Query{Func: "."}}}}}}}, + "INDEX": []*FuncDef{&FuncDef{Name: "INDEX", Args: []string{"stream", "idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "stream"}}, Pattern: &Pattern{Name: "$row"}, Start: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{}}}, Update: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Left: &Query{Func: "$row"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "idx_expr"}, Op: OpPipe, Right: &Query{Func: "tostring"}}}}}}, Op: OpAssign, Right: &Query{Func: "$row"}}}}}}, &FuncDef{Name: "INDEX", Args: []string{"idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "INDEX", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "idx_expr"}}}}}}}, + "JOIN": []*FuncDef{&FuncDef{Name: "JOIN", Args: []string{"$idx", "idx_expr"}, Body: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}}}}}}, &FuncDef{Name: "JOIN", Args: []string{"$idx", "stream", "idx_expr"}, Body: &Query{Left: &Query{Func: "stream"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}}}, &FuncDef{Name: "JOIN", Args: []string{"$idx", "stream", "idx_expr", "join_expr"}, Body: &Query{Left: &Query{Func: "stream"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$idx"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Func: "idx_expr"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "join_expr"}}}}}, + "_assign": []*FuncDef{&FuncDef{Name: "_assign", Args: []string{"ps", "$v"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "ps"}}}}, Pattern: &Pattern{Name: "$p"}, Start: &Query{Func: "."}, Update: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Func: "$p"}, &Query{Func: "$v"}}}}}}}}}}, + "_modify": []*FuncDef{&FuncDef{Name: "_modify", Args: []string{"ps", "f"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "ps"}}}}, Pattern: &Pattern{Name: "$p"}, Start: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}}}}}, Update: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}, Op: OpAdd, Right: &Query{Func: "$p"}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$q"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Func: "$q"}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$q"}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}}}}}}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "$p"}}}}}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$x"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "delpaths", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$x"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}}}}}}}}}, + "all": []*FuncDef{&FuncDef{Name: "all", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "all", Args: []*Query{&Query{Func: "."}}}}}}, &FuncDef{Name: "all", Args: []string{"y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "all", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "y"}}}}}}, &FuncDef{Name: "all", Args: []string{"g", "y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "isempty", Args: []*Query{&Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "y"}, Op: OpPipe, Right: &Query{Func: "not"}}}}}}}}}}}}}, + "any": []*FuncDef{&FuncDef{Name: "any", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Func: "."}}}}}}, &FuncDef{Name: "any", Args: []string{"y"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "any", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, &Query{Func: "y"}}}}}}, &FuncDef{Name: "any", Args: []string{"g", "y"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "isempty", Args: []*Query{&Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "y"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "not"}}}}, + "arrays": []*FuncDef{&FuncDef{Name: "arrays", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}}}}}}}, + "ascii_downcase": []*FuncDef{&FuncDef{Name: "ascii_downcase", Body: &Query{Left: &Query{Func: "explode"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeNumber, Number: "65"}}, Op: OpLe, Right: &Query{Func: "."}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "90"}}}}, Then: &Query{Left: &Query{Func: "."}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "32"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "implode"}}}}}, + "ascii_upcase": []*FuncDef{&FuncDef{Name: "ascii_upcase", Body: &Query{Left: &Query{Func: "explode"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeNumber, Number: "97"}}, Op: OpLe, Right: &Query{Func: "."}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "122"}}}}, Then: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "32"}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "implode"}}}}}, + "booleans": []*FuncDef{&FuncDef{Name: "booleans", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "boolean"}}}}}}}}}}, + "capture": []*FuncDef{&FuncDef{Name: "capture", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "capture", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "capture", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}, Op: OpPipe, Right: &Query{Func: "_capture"}}}}, + "combinations": []*FuncDef{&FuncDef{Name: "combinations", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}, Else: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "$x"}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}, IsSlice: true}}}, Op: OpPipe, Right: &Query{Func: "combinations"}}}}}}}}}}}}}}, &FuncDef{Name: "combinations", Args: []string{"n"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "limit", Args: []*Query{&Query{Func: "n"}, &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "repeat", Args: []*Query{&Query{Func: "."}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "combinations"}}}}, + "del": []*FuncDef{&FuncDef{Name: "del", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "delpaths", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: "f"}}}}}}}}}}}}}}, + "finites": []*FuncDef{&FuncDef{Name: "finites", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "isfinite"}}}}}}}, + "first": []*FuncDef{&FuncDef{Name: "first", Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}, &FuncDef{Name: "first", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}}}}, + "fromdate": []*FuncDef{&FuncDef{Name: "fromdate", Body: &Query{Func: "fromdateiso8601"}}}, "fromdateiso8601": []*FuncDef{&FuncDef{Name: "fromdateiso8601", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "strptime", Args: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "%Y-%m-%dT%H:%M:%S%z"}}}}}}}, Op: OpPipe, Right: &Query{Func: "mktime"}}}}, - "fromstream": []*FuncDef{&FuncDef{Name: "fromstream", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "x", Val: &ObjectVal{Queries: []*Query{&Query{Func: "null"}}}}, &ObjectKeyVal{Key: "e", Val: &ObjectVal{Queries: []*Query{&Query{Func: "false"}}}}}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$init"}}, Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "f"}}, Pattern: &Pattern{Name: "$i"}, Start: &Query{Func: "$init"}, Update: &Query{Left: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "e"}}}, Then: &Query{Func: "$init"}, Else: &Query{Func: "."}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$i"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "2"}}}}, Then: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "e"}}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "x"}}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}}, &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "e"}}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}, Extract: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "e"}}}, Then: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "x"}}}, Else: &Query{Func: "empty"}}}}}}}}}}}}}}, - "group_by": []*FuncDef{&FuncDef{Name: "group_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_group_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, - "gsub": []*FuncDef{&FuncDef{Name: "gsub", Args: []string{"$re", "str"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}, &FuncDef{Name: "gsub", Args: []string{"$re", "str", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Left: &Query{Func: "$flags"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}}}, - "in": []*FuncDef{&FuncDef{Name: "in", Args: []string{"xs"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Func: "xs"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "has", Args: []*Query{&Query{Func: "$x"}}}}}}}}}}}}}, - "inputs": []*FuncDef{&FuncDef{Name: "inputs", Body: &Query{Term: &Term{Type: TermTypeTry, Try: &Try{Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "repeat", Args: []*Query{&Query{Func: "input"}}}}}, Catch: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "break"}}}}, Then: &Query{Func: "empty"}, Else: &Query{Func: "error"}}}}}}}}}, - "inside": []*FuncDef{&FuncDef{Name: "inside", Args: []string{"xs"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Func: "xs"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "contains", Args: []*Query{&Query{Func: "$x"}}}}}}}}}}}}}, - "isempty": []*FuncDef{&FuncDef{Name: "isempty", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "false"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}, Op: OpComma, Right: &Query{Func: "true"}}}}}}}, - "iterables": []*FuncDef{&FuncDef{Name: "iterables", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpOr, Right: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}}}, - "last": []*FuncDef{&FuncDef{Name: "last", Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}, &FuncDef{Name: "last", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Func: "null"}, Update: &Query{Func: "$item"}}}}}}, - "leaf_paths": []*FuncDef{&FuncDef{Name: "leaf_paths", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "paths", Args: []*Query{&Query{Func: "scalars"}}}}}}}, - "limit": []*FuncDef{&FuncDef{Name: "limit", Args: []string{"$n", "g"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Func: "$n"}, Update: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Extract: &Query{Left: &Query{Func: "$item"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}, Else: &Query{Func: "empty"}}}}}}}}}}}, Elif: []*IfElif{&IfElif{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Func: "empty"}}}, Else: &Query{Func: "g"}}}}}}, - "map": []*FuncDef{&FuncDef{Name: "map", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}}, - "map_values": []*FuncDef{&FuncDef{Name: "map_values", Args: []string{"f"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpModify, Right: &Query{Func: "f"}}}}, - "match": []*FuncDef{&FuncDef{Name: "match", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "match", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}, &Query{Func: "false"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}}}}, - "max_by": []*FuncDef{&FuncDef{Name: "max_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_max_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, - "min_by": []*FuncDef{&FuncDef{Name: "min_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_min_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, - "normals": []*FuncDef{&FuncDef{Name: "normals", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "isnormal"}}}}}}}, - "not": []*FuncDef{&FuncDef{Name: "not", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "."}, Then: &Query{Func: "false"}, Else: &Query{Func: "true"}}}}}}, - "nth": []*FuncDef{&FuncDef{Name: "nth", Args: []string{"$n"}, Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Func: "$n"}}}}}, &FuncDef{Name: "nth", Args: []string{"$n", "g"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpLt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "error", Args: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "nth doesn't support negative indices"}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Left: &Query{Func: "$n"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Update: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Extract: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Left: &Query{Func: "$item"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}, Else: &Query{Func: "empty"}}}}}}}}}}}}}}}, - "nulls": []*FuncDef{&FuncDef{Name: "nulls", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Func: "null"}}}}}}}}, - "numbers": []*FuncDef{&FuncDef{Name: "numbers", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "number"}}}}}}}}}}, - "objects": []*FuncDef{&FuncDef{Name: "objects", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}, - "paths": []*FuncDef{&FuncDef{Name: "paths", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: ".."}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}}}}}}}}, &FuncDef{Name: "paths", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "paths"}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$p"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$p"}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}, Op: OpPipe, Right: &Query{Func: "$p"}}}}}}}}}, - "range": []*FuncDef{&FuncDef{Name: "range", Args: []string{"$end"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}, &Query{Func: "$end"}, &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}, &FuncDef{Name: "range", Args: []string{"$start", "$end"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Func: "$start"}, &Query{Func: "$end"}, &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}, &FuncDef{Name: "range", Args: []string{"$start", "$end", "$step"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Func: "$start"}, &Query{Func: "$end"}, &Query{Func: "$step"}}}}}}}, - "recurse": []*FuncDef{&FuncDef{Name: "recurse", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "recurse", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}}}}}}, &FuncDef{Name: "recurse", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "f"}, Op: OpPipe, Right: &Query{Func: "r"}}}}}}}, Func: "r"}}, &FuncDef{Name: "recurse", Args: []string{"f", "cond"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "f"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "cond"}}}}}, Op: OpPipe, Right: &Query{Func: "r"}}}}}}}}, Func: "r"}}}, - "repeat": []*FuncDef{&FuncDef{Name: "repeat", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_repeat", Body: &Query{Left: &Query{Func: "f"}, Op: OpComma, Right: &Query{Func: "_repeat"}}}}, Func: "_repeat"}}}, - "scalars": []*FuncDef{&FuncDef{Name: "scalars", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}}}, - "scan": []*FuncDef{&FuncDef{Name: "scan", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "scan", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "scan", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Left: &Query{Func: "$flags"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "captures"}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}, Then: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "captures"}, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Index: &Index{Name: "string"}}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, - "select": []*FuncDef{&FuncDef{Name: "select", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "f"}, Then: &Query{Func: "."}, Else: &Query{Func: "empty"}}}}}}, - "sort_by": []*FuncDef{&FuncDef{Name: "sort_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_sort_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, - "splits": []*FuncDef{&FuncDef{Name: "splits", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "splits", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "splits", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "split", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}}}}, - "strings": []*FuncDef{&FuncDef{Name: "strings", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "string"}}}}}}}}}}, - "sub": []*FuncDef{&FuncDef{Name: "sub", Args: []string{"$re", "str"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "sub", Args: []string{"$re", "str", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$str"}}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_sub", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}, Then: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}, &Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$r"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "string", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "$r"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "_capture"}, Op: OpPipe, Right: &Query{Func: "str"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$str"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "offset"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "length"}}}}}}, End: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "offset"}}}, IsSlice: true}}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, &ObjectKeyVal{Key: "offset", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "offset"}}}}}}}}, &ObjectKeyVal{Key: "matches", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}, SuffixList: []*Suffix{&Suffix{Index: &Index{End: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}, IsSlice: true}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "_sub"}}}}}}}, Else: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$str"}, SuffixList: []*Suffix{&Suffix{Index: &Index{End: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "offset"}}}, IsSlice: true}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, Left: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "string", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{}}}}}}, &ObjectKeyVal{Key: "matches", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "_sub"}}}}}}}}}, - "test": []*FuncDef{&FuncDef{Name: "test", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "test", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "test", Args: []string{"$re", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}, &Query{Func: "true"}}}}}}}, - "todate": []*FuncDef{&FuncDef{Name: "todate", Body: &Query{Func: "todateiso8601"}}}, - "todateiso8601": []*FuncDef{&FuncDef{Name: "todateiso8601", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "strftime", Args: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "%Y-%m-%dT%H:%M:%SZ"}}}}}}}}}, - "tostream": []*FuncDef{&FuncDef{Name: "tostream", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}, Op: OpPipe, Right: &Query{Func: "r"}}}}, Op: OpComma, Right: &Query{Func: "."}}}}, Func: "r"}}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$p"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$p"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}}}}, Pattern: &Pattern{Name: "$q"}, Start: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "$p"}, Op: OpComma, Right: &Query{Func: "."}}}}}, Update: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "$p"}, Op: OpAdd, Right: &Query{Func: "$q"}}}}}}}}}}}}}}}}, + "fromstream": []*FuncDef{&FuncDef{Name: "fromstream", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "x", Val: &ObjectVal{Queries: []*Query{&Query{Func: "null"}}}}, &ObjectKeyVal{Key: "e", Val: &ObjectVal{Queries: []*Query{&Query{Func: "false"}}}}}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$init"}}, Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "f"}}, Pattern: &Pattern{Name: "$i"}, Start: &Query{Func: "$init"}, Update: &Query{Left: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "e"}}}, Then: &Query{Func: "$init"}, Else: &Query{Func: "."}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$i"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "2"}}}}, Then: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "e"}}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Left: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "x"}}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}}, &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "setpath", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "e"}}}}}}, &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$i"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}}}}}, Extract: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "e"}}}, Then: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "x"}}}, Else: &Query{Func: "empty"}}}}}}}}}}}}}}, + "group_by": []*FuncDef{&FuncDef{Name: "group_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_group_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, + "gsub": []*FuncDef{&FuncDef{Name: "gsub", Args: []string{"$re", "str"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}, &FuncDef{Name: "gsub", Args: []string{"$re", "str", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Left: &Query{Func: "$flags"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}}}, + "in": []*FuncDef{&FuncDef{Name: "in", Args: []string{"xs"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Func: "xs"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "has", Args: []*Query{&Query{Func: "$x"}}}}}}}}}}}}}, + "inputs": []*FuncDef{&FuncDef{Name: "inputs", Body: &Query{Term: &Term{Type: TermTypeTry, Try: &Try{Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "repeat", Args: []*Query{&Query{Func: "input"}}}}}, Catch: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "break"}}}}, Then: &Query{Func: "empty"}, Else: &Query{Func: "error"}}}}}}}}}, + "inside": []*FuncDef{&FuncDef{Name: "inside", Args: []string{"xs"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$x"}}, Body: &Query{Left: &Query{Func: "xs"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "contains", Args: []*Query{&Query{Func: "$x"}}}}}}}}}}}}}, + "isempty": []*FuncDef{&FuncDef{Name: "isempty", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "g"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "false"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}}}}, Op: OpComma, Right: &Query{Func: "true"}}}}}}}, + "iterables": []*FuncDef{&FuncDef{Name: "iterables", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpOr, Right: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}}}, + "last": []*FuncDef{&FuncDef{Name: "last", Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}}, &FuncDef{Name: "last", Args: []string{"g"}, Body: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Func: "null"}, Update: &Query{Func: "$item"}}}}}}, + "leaf_paths": []*FuncDef{&FuncDef{Name: "leaf_paths", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "paths", Args: []*Query{&Query{Func: "scalars"}}}}}}}, + "limit": []*FuncDef{&FuncDef{Name: "limit", Args: []string{"$n", "g"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Func: "$n"}, Update: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Extract: &Query{Left: &Query{Func: "$item"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}, Else: &Query{Func: "empty"}}}}}}}}}}}, Elif: []*IfElif{&IfElif{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Func: "empty"}}}, Else: &Query{Func: "g"}}}}}}, + "map": []*FuncDef{&FuncDef{Name: "map", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}}, + "map_values": []*FuncDef{&FuncDef{Name: "map_values", Args: []string{"f"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}, Op: OpModify, Right: &Query{Func: "f"}}}}, + "match": []*FuncDef{&FuncDef{Name: "match", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "match", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}, &Query{Func: "false"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}}}}, + "max_by": []*FuncDef{&FuncDef{Name: "max_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_max_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, + "min_by": []*FuncDef{&FuncDef{Name: "min_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_min_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, + "normals": []*FuncDef{&FuncDef{Name: "normals", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "isnormal"}}}}}}}, + "not": []*FuncDef{&FuncDef{Name: "not", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "."}, Then: &Query{Func: "false"}, Else: &Query{Func: "true"}}}}}}, + "nth": []*FuncDef{&FuncDef{Name: "nth", Args: []string{"$n"}, Body: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Func: "$n"}}}}}, &FuncDef{Name: "nth", Args: []string{"$n", "g"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "$n"}, Op: OpLt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "error", Args: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "nth doesn't support negative indices"}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeLabel, Label: &Label{Ident: "$out", Body: &Query{Term: &Term{Type: TermTypeForeach, Foreach: &Foreach{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "g"}}, Pattern: &Pattern{Name: "$item"}, Start: &Query{Left: &Query{Func: "$n"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Update: &Query{Left: &Query{Func: "."}, Op: OpSub, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}, Extract: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "."}, Op: OpLe, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}, Then: &Query{Left: &Query{Func: "$item"}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeBreak, Break: "$out"}}}, Else: &Query{Func: "empty"}}}}}}}}}}}}}}}, + "nulls": []*FuncDef{&FuncDef{Name: "nulls", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Func: "null"}}}}}}}}, + "numbers": []*FuncDef{&FuncDef{Name: "numbers", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "number"}}}}}}}}}}, + "objects": []*FuncDef{&FuncDef{Name: "objects", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}, + "paths": []*FuncDef{&FuncDef{Name: "paths", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Func: ".."}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{}}}}}}}}}}, &FuncDef{Name: "paths", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "paths"}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$p"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$p"}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}}}, Op: OpPipe, Right: &Query{Func: "$p"}}}}}}}}}, + "range": []*FuncDef{&FuncDef{Name: "range", Args: []string{"$end"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}, &Query{Func: "$end"}, &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}, &FuncDef{Name: "range", Args: []string{"$start", "$end"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Func: "$start"}, &Query{Func: "$end"}, &Query{Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}}, &FuncDef{Name: "range", Args: []string{"$start", "$end", "$step"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_range", Args: []*Query{&Query{Func: "$start"}, &Query{Func: "$end"}, &Query{Func: "$step"}}}}}}}, + "recurse": []*FuncDef{&FuncDef{Name: "recurse", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "recurse", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}}}}}}, &FuncDef{Name: "recurse", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "f"}, Op: OpPipe, Right: &Query{Func: "r"}}}}}}}, Func: "r"}}, &FuncDef{Name: "recurse", Args: []string{"f", "cond"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "f"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Func: "cond"}}}}}, Op: OpPipe, Right: &Query{Func: "r"}}}}}}}}, Func: "r"}}}, + "repeat": []*FuncDef{&FuncDef{Name: "repeat", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_repeat", Body: &Query{Left: &Query{Func: "f"}, Op: OpComma, Right: &Query{Func: "_repeat"}}}}, Func: "_repeat"}}}, + "scalars": []*FuncDef{&FuncDef{Name: "scalars", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpAnd, Right: &Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}}}}}}}, + "scan": []*FuncDef{&FuncDef{Name: "scan", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "scan", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "scan", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Left: &Query{Func: "$flags"}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "g"}}}}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "captures"}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}, Then: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "captures"}, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Index: &Index{Name: "string"}}}}}}}}, Else: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, + "select": []*FuncDef{&FuncDef{Name: "select", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "f"}, Then: &Query{Func: "."}, Else: &Query{Func: "empty"}}}}}}, + "sort_by": []*FuncDef{&FuncDef{Name: "sort_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_sort_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, + "splits": []*FuncDef{&FuncDef{Name: "splits", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "splits", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "splits", Args: []string{"$re", "$flags"}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "split", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}}}}}}}, + "strings": []*FuncDef{&FuncDef{Name: "strings", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "type"}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "string"}}}}}}}}}}, + "sub": []*FuncDef{&FuncDef{Name: "sub", Args: []string{"$re", "str"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "sub", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "str"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "sub", Args: []string{"$re", "str", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$str"}}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_sub", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpGt, Right: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}, Then: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}}}, &Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$r"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "string", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "$r"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "_capture"}, Op: OpPipe, Right: &Query{Func: "str"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$str"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Start: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "offset"}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "length"}}}}}}, End: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "offset"}}}, IsSlice: true}}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, &ObjectKeyVal{Key: "offset", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$r"}, SuffixList: []*Suffix{&Suffix{Index: &Index{Name: "offset"}}}}}}}}, &ObjectKeyVal{Key: "matches", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "matches"}, SuffixList: []*Suffix{&Suffix{Index: &Index{End: &Query{Term: &Term{Type: TermTypeUnary, Unary: &Unary{Op: OpSub, Term: &Term{Type: TermTypeNumber, Number: "1"}}}}, IsSlice: true}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "_sub"}}}}}}}, Else: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "$str"}, SuffixList: []*Suffix{&Suffix{Index: &Index{End: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "offset"}}}, IsSlice: true}}}}}, Op: OpAdd, Right: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Name: "string"}}}}}}}}}, Left: &Query{Term: &Term{Type: TermTypeObject, Object: &Object{KeyVals: []*ObjectKeyVal{&ObjectKeyVal{Key: "string", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{}}}}}}, &ObjectKeyVal{Key: "matches", Val: &ObjectVal{Queries: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}}}}}}}}}}}}}}}, Op: OpPipe, Right: &Query{Func: "_sub"}}}}}}}}}, + "test": []*FuncDef{&FuncDef{Name: "test", Args: []string{"$re"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "test", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "null"}}}}}}, &FuncDef{Name: "test", Args: []string{"$re", "$flags"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_match", Args: []*Query{&Query{Func: "$re"}, &Query{Func: "$flags"}, &Query{Func: "true"}}}}}}}, + "todate": []*FuncDef{&FuncDef{Name: "todate", Body: &Query{Func: "todateiso8601"}}}, + "todateiso8601": []*FuncDef{&FuncDef{Name: "todateiso8601", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "strftime", Args: []*Query{&Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "%Y-%m-%dT%H:%M:%SZ"}}}}}}}}}, + "tostream": []*FuncDef{&FuncDef{Name: "tostream", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{FuncDefs: []*FuncDef{&FuncDef{Name: "r", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}, Op: OpPipe, Right: &Query{Func: "r"}}}}, Op: OpComma, Right: &Query{Func: "."}}}}, Func: "r"}}}, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$p"}}, Body: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "getpath", Args: []*Query{&Query{Func: "$p"}}}}}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeReduce, Reduce: &Reduce{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "path", Args: []*Query{&Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Iter: true}, &Suffix{Optional: true}}}}}}}, Pattern: &Pattern{Name: "$q"}, Start: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "$p"}, Op: OpComma, Right: &Query{Func: "."}}}}}, Update: &Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Left: &Query{Func: "$p"}, Op: OpAdd, Right: &Query{Func: "$q"}}}}}}}}}}}}}}}}, "truncate_stream": []*FuncDef{&FuncDef{Name: "truncate_stream", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeIdentity, SuffixList: []*Suffix{&Suffix{Bind: &Bind{Patterns: []*Pattern{&Pattern{Name: "$n"}}, Body: &Query{Left: &Query{Func: "null"}, Op: OpPipe, Right: &Query{Left: &Query{Func: "f"}, Op: OpPipe, Right: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}, Op: OpPipe, Right: &Query{Left: &Query{Func: "length"}, Op: OpGt, Right: &Query{Func: "$n"}}}, Then: &Query{Left: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Term: &Term{Type: TermTypeNumber, Number: "0"}}}}}, Op: OpModify, Right: &Query{Term: &Term{Type: TermTypeIndex, Index: &Index{Start: &Query{Func: "$n"}, IsSlice: true}}}}, Else: &Query{Func: "empty"}}}}}}}}}}}}}, - "unique_by": []*FuncDef{&FuncDef{Name: "unique_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_unique_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, - "until": []*FuncDef{&FuncDef{Name: "until", Args: []string{"cond", "next"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_until", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "cond"}, Then: &Query{Func: "."}, Else: &Query{Left: &Query{Func: "next"}, Op: OpPipe, Right: &Query{Func: "_until"}}}}}}}, Func: "_until"}}}, - "values": []*FuncDef{&FuncDef{Name: "values", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Func: "null"}}}}}}}}, - "walk": []*FuncDef{&FuncDef{Name: "walk", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_walk", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpOr, Right: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}, Then: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map_values", Args: []*Query{&Query{Func: "_walk"}}}}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}, Func: "_walk"}}}, - "while": []*FuncDef{&FuncDef{Name: "while", Args: []string{"cond", "update"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_while", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "cond"}, Then: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "update"}, Op: OpPipe, Right: &Query{Func: "_while"}}}}}, Else: &Query{Func: "empty"}}}}}}, Func: "_while"}}}, - "with_entries": []*FuncDef{&FuncDef{Name: "with_entries", Args: []string{"f"}, Body: &Query{Left: &Query{Func: "to_entries"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Func: "f"}}}}}, Op: OpPipe, Right: &Query{Func: "from_entries"}}}}}, + "unique_by": []*FuncDef{&FuncDef{Name: "unique_by", Args: []string{"f"}, Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "_unique_by", Args: []*Query{&Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Term: &Term{Type: TermTypeArray, Array: &Array{Query: &Query{Func: "f"}}}}}}}}}}}}}}, + "until": []*FuncDef{&FuncDef{Name: "until", Args: []string{"cond", "next"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_until", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "cond"}, Then: &Query{Func: "."}, Else: &Query{Left: &Query{Func: "next"}, Op: OpPipe, Right: &Query{Func: "_until"}}}}}}}, Func: "_until"}}}, + "values": []*FuncDef{&FuncDef{Name: "values", Body: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "select", Args: []*Query{&Query{Left: &Query{Func: "."}, Op: OpNe, Right: &Query{Func: "null"}}}}}}}}, + "walk": []*FuncDef{&FuncDef{Name: "walk", Args: []string{"f"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_walk", Body: &Query{Left: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Left: &Query{Func: "type"}, Op: OpPipe, Right: &Query{Left: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "array"}}}}, Op: OpOr, Right: &Query{Left: &Query{Func: "."}, Op: OpEq, Right: &Query{Term: &Term{Type: TermTypeString, Str: &String{Str: "object"}}}}}}, Then: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map_values", Args: []*Query{&Query{Func: "_walk"}}}}}}}}, Op: OpPipe, Right: &Query{Func: "f"}}}}, Func: "_walk"}}}, + "while": []*FuncDef{&FuncDef{Name: "while", Args: []string{"cond", "update"}, Body: &Query{FuncDefs: []*FuncDef{&FuncDef{Name: "_while", Body: &Query{Term: &Term{Type: TermTypeIf, If: &If{Cond: &Query{Func: "cond"}, Then: &Query{Left: &Query{Func: "."}, Op: OpComma, Right: &Query{Term: &Term{Type: TermTypeQuery, Query: &Query{Left: &Query{Func: "update"}, Op: OpPipe, Right: &Query{Func: "_while"}}}}}, Else: &Query{Func: "empty"}}}}}}, Func: "_while"}}}, + "with_entries": []*FuncDef{&FuncDef{Name: "with_entries", Args: []string{"f"}, Body: &Query{Left: &Query{Func: "to_entries"}, Op: OpPipe, Right: &Query{Left: &Query{Term: &Term{Type: TermTypeFunc, Func: &Func{Name: "map", Args: []*Query{&Query{Func: "f"}}}}}, Op: OpPipe, Right: &Query{Func: "from_entries"}}}}}, } } diff --git a/api/vendor/github.com/itchyny/gojq/compare.go b/api/vendor/github.com/itchyny/gojq/compare.go index fc05451415ec..40ccce89a138 100644 --- a/api/vendor/github.com/itchyny/gojq/compare.go +++ b/api/vendor/github.com/itchyny/gojq/compare.go @@ -7,9 +7,9 @@ import ( // Compare l and r, and returns jq-flavored comparison value. // -// -1 if l < r -// 0 if l == r -// +1 if l > r +// -1 if l < r +// 0 if l == r +// +1 if l > r // // This comparison is used by built-in operators and functions. func Compare(l, r interface{}) int { diff --git a/api/vendor/github.com/itchyny/gojq/module_loader.go b/api/vendor/github.com/itchyny/gojq/module_loader.go index 7c45904dc880..e3ac4d167c5a 100644 --- a/api/vendor/github.com/itchyny/gojq/module_loader.go +++ b/api/vendor/github.com/itchyny/gojq/module_loader.go @@ -13,11 +13,11 @@ import ( // // Implement following optional methods. Use NewModuleLoader to load local modules. // -// LoadModule(string) (*Query, error) -// LoadModuleWithMeta(string, map[string]interface{}) (*Query, error) -// LoadInitModules() ([]*Query, error) -// LoadJSON(string) (interface{}, error) -// LoadJSONWithMeta(string, map[string]interface{}) (interface{}, error) +// LoadModule(string) (*Query, error) +// LoadModuleWithMeta(string, map[string]interface{}) (*Query, error) +// LoadInitModules() ([]*Query, error) +// LoadJSON(string) (interface{}, error) +// LoadJSONWithMeta(string, map[string]interface{}) (interface{}, error) type ModuleLoader interface{} // NewModuleLoader creates a new ModuleLoader reading local modules in the paths. diff --git a/api/vendor/github.com/jinzhu/inflection/inflections.go b/api/vendor/github.com/jinzhu/inflection/inflections.go index 606263bb7507..01fecd5c1c84 100644 --- a/api/vendor/github.com/jinzhu/inflection/inflections.go +++ b/api/vendor/github.com/jinzhu/inflection/inflections.go @@ -1,25 +1,25 @@ /* Package inflection pluralizes and singularizes English nouns. - inflection.Plural("person") => "people" - inflection.Plural("Person") => "People" - inflection.Plural("PERSON") => "PEOPLE" + inflection.Plural("person") => "people" + inflection.Plural("Person") => "People" + inflection.Plural("PERSON") => "PEOPLE" - inflection.Singular("people") => "person" - inflection.Singular("People") => "Person" - inflection.Singular("PEOPLE") => "PERSON" + inflection.Singular("people") => "person" + inflection.Singular("People") => "Person" + inflection.Singular("PEOPLE") => "PERSON" - inflection.Plural("FancyPerson") => "FancydPeople" - inflection.Singular("FancyPeople") => "FancydPerson" + inflection.Plural("FancyPerson") => "FancydPeople" + inflection.Singular("FancyPeople") => "FancydPerson" Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb) If you want to register more rules, follow: - inflection.AddUncountable("fish") - inflection.AddIrregular("person", "people") - inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses" - inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS" + inflection.AddUncountable("fish") + inflection.AddIrregular("person", "people") + inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses" + inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS" */ package inflection diff --git a/api/vendor/github.com/jinzhu/now/main.go b/api/vendor/github.com/jinzhu/now/main.go index e972cd8d5574..4428d438cc7b 100644 --- a/api/vendor/github.com/jinzhu/now/main.go +++ b/api/vendor/github.com/jinzhu/now/main.go @@ -2,11 +2,11 @@ // // More details README here: https://github.com/jinzhu/now // -// import "github.com/jinzhu/now" +// import "github.com/jinzhu/now" // -// now.BeginningOfMinute() // 2013-11-18 17:51:00 Mon -// now.BeginningOfDay() // 2013-11-18 00:00:00 Mon -// now.EndOfDay() // 2013-11-18 23:59:59.999999999 Mon +// now.BeginningOfMinute() // 2013-11-18 17:51:00 Mon +// now.BeginningOfDay() // 2013-11-18 00:00:00 Mon +// now.EndOfDay() // 2013-11-18 23:59:59.999999999 Mon package now import "time" diff --git a/api/vendor/github.com/jinzhu/now/now.go b/api/vendor/github.com/jinzhu/now/now.go index d1fb8ae1d76a..f25fc9146678 100644 --- a/api/vendor/github.com/jinzhu/now/now.go +++ b/api/vendor/github.com/jinzhu/now/now.go @@ -150,7 +150,7 @@ func (now *Now) parseWithFormat(str string, location *time.Location) (t time.Tim } var hasTimeRegexp = regexp.MustCompile(`(\s+|^\s*|T)\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))(\s*$|[Z+-])`) // match 15:04:05, 15:04:05.000, 15:04:05.000000 15, 2017-01-01 15:04, 2021-07-20T00:59:10Z, 2021-07-20T00:59:10+08:00, 2021-07-20T00:00:10-07:00 etc -var onlyTimeRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`) // match 15:04:05, 15, 15:04:05.000, 15:04:05.000000, etc +var onlyTimeRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`) // match 15:04:05, 15, 15:04:05.000, 15:04:05.000000, etc // Parse parse string to time func (now *Now) Parse(strs ...string) (t time.Time, err error) { diff --git a/api/vendor/github.com/json-iterator/go/iter_float.go b/api/vendor/github.com/json-iterator/go/iter_float.go index 8a3d8b6fb43c..caf16feec89d 100644 --- a/api/vendor/github.com/json-iterator/go/iter_float.go +++ b/api/vendor/github.com/json-iterator/go/iter_float.go @@ -66,7 +66,7 @@ func (iter *Iterator) ReadBigInt() (ret *big.Int) { return ret } -//ReadFloat32 read float32 +// ReadFloat32 read float32 func (iter *Iterator) ReadFloat32() (ret float32) { c := iter.nextToken() if c == '-' { diff --git a/api/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/api/vendor/github.com/json-iterator/go/iter_skip_sloppy.go index 9303de41e400..3d993f27731b 100644 --- a/api/vendor/github.com/json-iterator/go/iter_skip_sloppy.go +++ b/api/vendor/github.com/json-iterator/go/iter_skip_sloppy.go @@ -1,4 +1,5 @@ -//+build jsoniter_sloppy +//go:build jsoniter_sloppy +// +build jsoniter_sloppy package jsoniter diff --git a/api/vendor/github.com/json-iterator/go/iter_skip_strict.go b/api/vendor/github.com/json-iterator/go/iter_skip_strict.go index 6cf66d0438db..f1ad6591bb0c 100644 --- a/api/vendor/github.com/json-iterator/go/iter_skip_strict.go +++ b/api/vendor/github.com/json-iterator/go/iter_skip_strict.go @@ -1,4 +1,5 @@ -//+build !jsoniter_sloppy +//go:build !jsoniter_sloppy +// +build !jsoniter_sloppy package jsoniter diff --git a/api/vendor/github.com/lib/pq/array.go b/api/vendor/github.com/lib/pq/array.go index 39c8f7e2e032..9957c04891d2 100644 --- a/api/vendor/github.com/lib/pq/array.go +++ b/api/vendor/github.com/lib/pq/array.go @@ -19,10 +19,11 @@ var typeSQLScanner = reflect.TypeOf((*sql.Scanner)(nil)).Elem() // slice of any dimension. // // For example: -// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401})) // -// var x []sql.NullInt64 -// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x)) +// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401})) +// +// var x []sql.NullInt64 +// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x)) // // Scanning multi-dimensional arrays is not supported. Arrays where the lower // bound is not one (such as `[0:0]={1}') are not supported. diff --git a/api/vendor/github.com/lib/pq/doc.go b/api/vendor/github.com/lib/pq/doc.go index b57184801ba9..96309ff89f9d 100644 --- a/api/vendor/github.com/lib/pq/doc.go +++ b/api/vendor/github.com/lib/pq/doc.go @@ -27,9 +27,7 @@ You can also connect to a database using a URL. For example: connStr := "postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full" db, err := sql.Open("postgres", connStr) - -Connection String Parameters - +# Connection String Parameters Similarly to libpq, when establishing a connection using pq you are expected to supply a connection string containing zero or more parameters. @@ -42,42 +40,42 @@ them in the options parameter. For compatibility with libpq, the following special connection parameters are supported: - * dbname - The name of the database to connect to - * user - The user to sign in as - * password - The user's password - * host - The host to connect to. Values that start with / are for unix - domain sockets. (default is localhost) - * port - The port to bind to. (default is 5432) - * sslmode - Whether or not to use SSL (default is require, this is not - the default for libpq) - * fallback_application_name - An application_name to fall back to if one isn't provided. - * connect_timeout - Maximum wait for connection, in seconds. Zero or - not specified means wait indefinitely. - * sslcert - Cert file location. The file must contain PEM encoded data. - * sslkey - Key file location. The file must contain PEM encoded data. - * sslrootcert - The location of the root certificate file. The file - must contain PEM encoded data. + - dbname - The name of the database to connect to + - user - The user to sign in as + - password - The user's password + - host - The host to connect to. Values that start with / are for unix + domain sockets. (default is localhost) + - port - The port to bind to. (default is 5432) + - sslmode - Whether or not to use SSL (default is require, this is not + the default for libpq) + - fallback_application_name - An application_name to fall back to if one isn't provided. + - connect_timeout - Maximum wait for connection, in seconds. Zero or + not specified means wait indefinitely. + - sslcert - Cert file location. The file must contain PEM encoded data. + - sslkey - Key file location. The file must contain PEM encoded data. + - sslrootcert - The location of the root certificate file. The file + must contain PEM encoded data. Valid values for sslmode are: - * disable - No SSL - * require - Always SSL (skip verification) - * verify-ca - Always SSL (verify that the certificate presented by the - server was signed by a trusted CA) - * verify-full - Always SSL (verify that the certification presented by - the server was signed by a trusted CA and the server host name - matches the one in the certificate) + - disable - No SSL + - require - Always SSL (skip verification) + - verify-ca - Always SSL (verify that the certificate presented by the + server was signed by a trusted CA) + - verify-full - Always SSL (verify that the certification presented by + the server was signed by a trusted CA and the server host name + matches the one in the certificate) See http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING for more information about connection string parameters. Use single quotes for values that contain whitespace: - "user=pqgotest password='with spaces'" + "user=pqgotest password='with spaces'" A backslash will escape the next character in values: - "user=space\ man password='it\'s valid'" + "user=space\ man password='it\'s valid'" Note that the connection parameter client_encoding (which sets the text encoding for the connection) may be set but must be "UTF8", @@ -98,9 +96,7 @@ provided connection parameters. The pgpass mechanism as described in http://www.postgresql.org/docs/current/static/libpq-pgpass.html is supported, but on Windows PGPASSFILE must be specified explicitly. - -Queries - +# Queries database/sql does not dictate any specific format for parameter markers in query strings, and pq uses the Postgres-native ordinal markers, @@ -125,9 +121,7 @@ For more details on RETURNING, see the Postgres documentation: For additional instructions on querying see the documentation for the database/sql package. - -Data Types - +# Data Types Parameters pass through driver.DefaultParameterConverter before they are handled by this package. When the binary_parameters connection option is enabled, @@ -135,30 +129,27 @@ by this package. When the binary_parameters connection option is enabled, This package returns the following types for values from the PostgreSQL backend: - - integer types smallint, integer, and bigint are returned as int64 - - floating-point types real and double precision are returned as float64 - - character types char, varchar, and text are returned as string - - temporal types date, time, timetz, timestamp, and timestamptz are - returned as time.Time - - the boolean type is returned as bool - - the bytea type is returned as []byte + - integer types smallint, integer, and bigint are returned as int64 + - floating-point types real and double precision are returned as float64 + - character types char, varchar, and text are returned as string + - temporal types date, time, timetz, timestamp, and timestamptz are + returned as time.Time + - the boolean type is returned as bool + - the bytea type is returned as []byte All other types are returned directly from the backend as []byte values in text format. - -Errors - +# Errors pq may return errors of type *pq.Error which can be interrogated for error details: - if err, ok := err.(*pq.Error); ok { - fmt.Println("pq error:", err.Code.Name()) - } + if err, ok := err.(*pq.Error); ok { + fmt.Println("pq error:", err.Code.Name()) + } See the pq.Error type for details. - -Bulk imports +# Bulk imports You can perform bulk imports by preparing a statement returned by pq.CopyIn (or pq.CopyInSchema) in an explicit transaction (sql.Tx). The returned statement @@ -206,9 +197,7 @@ Usage example: log.Fatal(err) } - -Notifications - +# Notifications PostgreSQL supports a simple publish/subscribe model over database connections. See http://www.postgresql.org/docs/current/static/sql-notify.html @@ -241,9 +230,7 @@ bytes by the PostgreSQL server. You can find a complete, working example of Listener usage at https://godoc.org/github.com/lib/pq/example/listen. - -Kerberos Support - +# Kerberos Support If you need support for Kerberos authentication, add the following to your main package: @@ -259,10 +246,10 @@ don't have to download unnecessary dependencies. When imported, additional connection string parameters are supported: - * krbsrvname - GSS (Kerberos) service name when constructing the - SPN (default is `postgres`). This will be combined with the host - to form the full SPN: `krbsrvname/host`. - * krbspn - GSS (Kerberos) SPN. This takes priority over - `krbsrvname` if present. + - krbsrvname - GSS (Kerberos) service name when constructing the + SPN (default is `postgres`). This will be combined with the host + to form the full SPN: `krbsrvname/host`. + - krbspn - GSS (Kerberos) SPN. This takes priority over + `krbsrvname` if present. */ package pq diff --git a/api/vendor/github.com/lib/pq/notify.go b/api/vendor/github.com/lib/pq/notify.go index 5c421fdb8b56..5e68d5364936 100644 --- a/api/vendor/github.com/lib/pq/notify.go +++ b/api/vendor/github.com/lib/pq/notify.go @@ -330,11 +330,11 @@ func (l *ListenerConn) sendSimpleQuery(q string) (err error) { // ExecSimpleQuery executes a "simple query" (i.e. one with no bindable // parameters) on the connection. The possible return values are: -// 1) "executed" is true; the query was executed to completion on the -// database server. If the query failed, err will be set to the error -// returned by the database, otherwise err will be nil. -// 2) If "executed" is false, the query could not be executed on the remote -// server. err will be non-nil. +// 1. "executed" is true; the query was executed to completion on the +// database server. If the query failed, err will be set to the error +// returned by the database, otherwise err will be nil. +// 2. If "executed" is false, the query could not be executed on the remote +// server. err will be non-nil. // // After a call to ExecSimpleQuery has returned an executed=false value, the // connection has either been closed or will be closed shortly thereafter, and @@ -541,12 +541,12 @@ func (l *Listener) NotificationChannel() <-chan *Notification { // connection can not be re-established. // // Listen will only fail in three conditions: -// 1) The channel is already open. The returned error will be -// ErrChannelAlreadyOpen. -// 2) The query was executed on the remote server, but PostgreSQL returned an -// error message in response to the query. The returned error will be a -// pq.Error containing the information the server supplied. -// 3) Close is called on the Listener before the request could be completed. +// 1. The channel is already open. The returned error will be +// ErrChannelAlreadyOpen. +// 2. The query was executed on the remote server, but PostgreSQL returned an +// error message in response to the query. The returned error will be a +// pq.Error containing the information the server supplied. +// 3. Close is called on the Listener before the request could be completed. // // The channel name is case-sensitive. func (l *Listener) Listen(channel string) error { diff --git a/api/vendor/github.com/lib/pq/scram/scram.go b/api/vendor/github.com/lib/pq/scram/scram.go index 477216b6008a..0e1ef6563283 100644 --- a/api/vendor/github.com/lib/pq/scram/scram.go +++ b/api/vendor/github.com/lib/pq/scram/scram.go @@ -25,7 +25,6 @@ // Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. // // http://tools.ietf.org/html/rfc5802 -// package scram import ( @@ -43,17 +42,16 @@ import ( // // A Client may be used within a SASL conversation with logic resembling: // -// var in []byte -// var client = scram.NewClient(sha1.New, user, pass) -// for client.Step(in) { -// out := client.Out() -// // send out to server -// in := serverOut -// } -// if client.Err() != nil { -// // auth failed -// } -// +// var in []byte +// var client = scram.NewClient(sha1.New, user, pass) +// for client.Step(in) { +// out := client.Out() +// // send out to server +// in := serverOut +// } +// if client.Err() != nil { +// // auth failed +// } type Client struct { newHash func() hash.Hash @@ -73,8 +71,7 @@ type Client struct { // // For SCRAM-SHA-256, for example, use: // -// client := scram.NewClient(sha256.New, user, pass) -// +// client := scram.NewClient(sha256.New, user, pass) func NewClient(newHash func() hash.Hash, user, pass string) *Client { c := &Client{ newHash: newHash, diff --git a/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go b/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go index ff7b27c5b203..87f7fb7a4459 100644 --- a/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go +++ b/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go @@ -2,8 +2,8 @@ // easyjson_nounsafe nor appengine build tag is set. See README notes // for more details. -//+build !easyjson_nounsafe -//+build !appengine +//go:build !easyjson_nounsafe && !appengine +// +build !easyjson_nounsafe,!appengine package jlexer diff --git a/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go b/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go index 864d1be67638..5c24365ccdb6 100644 --- a/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go +++ b/api/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go @@ -1,7 +1,8 @@ // This file is included to the build if any of the buildtags below // are defined. Refer to README notes for more details. -//+build easyjson_nounsafe appengine +//go:build easyjson_nounsafe || appengine +// +build easyjson_nounsafe appengine package jlexer diff --git a/api/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/api/vendor/github.com/mitchellh/mapstructure/mapstructure.go index 1efb22ac3610..fadccc4ab8d1 100644 --- a/api/vendor/github.com/mitchellh/mapstructure/mapstructure.go +++ b/api/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -9,84 +9,84 @@ // // The simplest function to start with is Decode. // -// Field Tags +// # Field Tags // // When decoding to a struct, mapstructure will use the field name by // default to perform the mapping. For example, if a struct has a field // "Username" then mapstructure will look for a key in the source value // of "username" (case insensitive). // -// type User struct { -// Username string -// } +// type User struct { +// Username string +// } // // You can change the behavior of mapstructure by using struct tags. // The default struct tag that mapstructure looks for is "mapstructure" // but you can customize it using DecoderConfig. // -// Renaming Fields +// # Renaming Fields // // To rename the key that mapstructure looks for, use the "mapstructure" // tag and set a value directly. For example, to change the "username" example // above to "user": // -// type User struct { -// Username string `mapstructure:"user"` -// } +// type User struct { +// Username string `mapstructure:"user"` +// } // -// Embedded Structs and Squashing +// # Embedded Structs and Squashing // // Embedded structs are treated as if they're another field with that name. // By default, the two structs below are equivalent when decoding with // mapstructure: // -// type Person struct { -// Name string -// } +// type Person struct { +// Name string +// } // -// type Friend struct { -// Person -// } +// type Friend struct { +// Person +// } // -// type Friend struct { -// Person Person -// } +// type Friend struct { +// Person Person +// } // // This would require an input that looks like below: // -// map[string]interface{}{ -// "person": map[string]interface{}{"name": "alice"}, -// } +// map[string]interface{}{ +// "person": map[string]interface{}{"name": "alice"}, +// } // // If your "person" value is NOT nested, then you can append ",squash" to // your tag value and mapstructure will treat it as if the embedded struct // were part of the struct directly. Example: // -// type Friend struct { -// Person `mapstructure:",squash"` -// } +// type Friend struct { +// Person `mapstructure:",squash"` +// } // // Now the following input would be accepted: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // When decoding from a struct to a map, the squash tag squashes the struct // fields into a single map. Using the example structs from above: // -// Friend{Person: Person{Name: "alice"}} +// Friend{Person: Person{Name: "alice"}} // // Will be decoded into a map: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. // -// Remainder Values +// # Remainder Values // // If there are any unmapped keys in the source value, mapstructure by // default will silently ignore them. You can error by setting ErrorUnused @@ -98,20 +98,20 @@ // probably be a "map[string]interface{}" or "map[interface{}]interface{}". // See example below: // -// type Friend struct { -// Name string -// Other map[string]interface{} `mapstructure:",remain"` -// } +// type Friend struct { +// Name string +// Other map[string]interface{} `mapstructure:",remain"` +// } // // Given the input below, Other would be populated with the other // values that weren't used (everything but "name"): // -// map[string]interface{}{ -// "name": "bob", -// "address": "123 Maple St.", -// } +// map[string]interface{}{ +// "name": "bob", +// "address": "123 Maple St.", +// } // -// Omit Empty Values +// # Omit Empty Values // // When decoding from a struct to any other value, you may use the // ",omitempty" suffix on your tag to omit that value if it equates to @@ -122,37 +122,37 @@ // field value is zero and a numeric type, the field is empty, and it won't // be encoded into the destination type. // -// type Source struct { -// Age int `mapstructure:",omitempty"` -// } +// type Source struct { +// Age int `mapstructure:",omitempty"` +// } // -// Unexported fields +// # Unexported fields // // Since unexported (private) struct fields cannot be set outside the package // where they are defined, the decoder will simply skip them. // // For this output type definition: // -// type Exported struct { -// private string // this unexported field will be skipped -// Public string -// } +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } // // Using this map as input: // -// map[string]interface{}{ -// "private": "I will be ignored", -// "Public": "I made it through!", -// } +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } // // The following struct will be decoded: // -// type Exported struct { -// private: "" // field is left with an empty string (zero value) -// Public: "I made it through!" -// } +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// } // -// Other Configuration +// # Other Configuration // // mapstructure is highly configurable. See the DecoderConfig struct // for other features and options that are supported. diff --git a/api/vendor/github.com/modern-go/concurrent/go_above_19.go b/api/vendor/github.com/modern-go/concurrent/go_above_19.go index aeabf8c4f9c8..7db701945497 100644 --- a/api/vendor/github.com/modern-go/concurrent/go_above_19.go +++ b/api/vendor/github.com/modern-go/concurrent/go_above_19.go @@ -1,4 +1,5 @@ -//+build go1.9 +//go:build go1.9 +// +build go1.9 package concurrent diff --git a/api/vendor/github.com/modern-go/concurrent/go_below_19.go b/api/vendor/github.com/modern-go/concurrent/go_below_19.go index b9c8df7f4101..64544f5b35ba 100644 --- a/api/vendor/github.com/modern-go/concurrent/go_below_19.go +++ b/api/vendor/github.com/modern-go/concurrent/go_below_19.go @@ -1,4 +1,5 @@ -//+build !go1.9 +//go:build !go1.9 +// +build !go1.9 package concurrent diff --git a/api/vendor/github.com/modern-go/concurrent/log.go b/api/vendor/github.com/modern-go/concurrent/log.go index 9756fcc75a79..4899eed026de 100644 --- a/api/vendor/github.com/modern-go/concurrent/log.go +++ b/api/vendor/github.com/modern-go/concurrent/log.go @@ -1,13 +1,13 @@ package concurrent import ( - "os" - "log" "io/ioutil" + "log" + "os" ) // ErrorLogger is used to print out error, can be set to writer other than stderr var ErrorLogger = log.New(os.Stderr, "", 0) // InfoLogger is used to print informational message, default to off -var InfoLogger = log.New(ioutil.Discard, "", 0) \ No newline at end of file +var InfoLogger = log.New(ioutil.Discard, "", 0) diff --git a/api/vendor/github.com/modern-go/concurrent/unbounded_executor.go b/api/vendor/github.com/modern-go/concurrent/unbounded_executor.go index 05a77dceb1e2..5ea18eb7bf98 100644 --- a/api/vendor/github.com/modern-go/concurrent/unbounded_executor.go +++ b/api/vendor/github.com/modern-go/concurrent/unbounded_executor.go @@ -3,11 +3,11 @@ package concurrent import ( "context" "fmt" + "reflect" "runtime" "runtime/debug" "sync" "time" - "reflect" ) // HandlePanic logs goroutine panic by default diff --git a/api/vendor/github.com/modern-go/reflect2/go_above_118.go b/api/vendor/github.com/modern-go/reflect2/go_above_118.go index 2b4116f6c9be..33c825f6d512 100644 --- a/api/vendor/github.com/modern-go/reflect2/go_above_118.go +++ b/api/vendor/github.com/modern-go/reflect2/go_above_118.go @@ -1,4 +1,5 @@ -//+build go1.18 +//go:build go1.18 +// +build go1.18 package reflect2 @@ -8,6 +9,7 @@ import ( // m escapes into the return value, but the caller of mapiterinit // doesn't let the return value escape. +// //go:noescape //go:linkname mapiterinit reflect.mapiterinit func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer, it *hiter) @@ -20,4 +22,4 @@ func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { pKeyRType: type2.pKeyRType, pElemRType: type2.pElemRType, } -} \ No newline at end of file +} diff --git a/api/vendor/github.com/modern-go/reflect2/go_above_19.go b/api/vendor/github.com/modern-go/reflect2/go_above_19.go index 974f7685e495..03ccb43c65bb 100644 --- a/api/vendor/github.com/modern-go/reflect2/go_above_19.go +++ b/api/vendor/github.com/modern-go/reflect2/go_above_19.go @@ -1,4 +1,5 @@ -//+build go1.9 +//go:build go1.9 +// +build go1.9 package reflect2 diff --git a/api/vendor/github.com/modern-go/reflect2/go_below_118.go b/api/vendor/github.com/modern-go/reflect2/go_below_118.go index 00003dbd7c57..092ec5b5d293 100644 --- a/api/vendor/github.com/modern-go/reflect2/go_below_118.go +++ b/api/vendor/github.com/modern-go/reflect2/go_below_118.go @@ -1,4 +1,5 @@ -//+build !go1.18 +//go:build !go1.18 +// +build !go1.18 package reflect2 @@ -8,6 +9,7 @@ import ( // m escapes into the return value, but the caller of mapiterinit // doesn't let the return value escape. +// //go:noescape //go:linkname mapiterinit reflect.mapiterinit func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) (val *hiter) @@ -18,4 +20,4 @@ func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { pKeyRType: type2.pKeyRType, pElemRType: type2.pElemRType, } -} \ No newline at end of file +} diff --git a/api/vendor/github.com/modern-go/reflect2/reflect2.go b/api/vendor/github.com/modern-go/reflect2/reflect2.go index c43c8b9d6297..b0c281fcac71 100644 --- a/api/vendor/github.com/modern-go/reflect2/reflect2.go +++ b/api/vendor/github.com/modern-go/reflect2/reflect2.go @@ -282,6 +282,7 @@ func likePtrType(typ reflect.Type) bool { // output depends on the input. noescape is inlined and currently // compiles down to zero instructions. // USE CAREFULLY! +// //go:nosplit func NoEscape(p unsafe.Pointer) unsafe.Pointer { x := uintptr(p) diff --git a/api/vendor/github.com/modern-go/reflect2/type_map.go b/api/vendor/github.com/modern-go/reflect2/type_map.go index 4b13c3155c80..54c8498ef1d7 100644 --- a/api/vendor/github.com/modern-go/reflect2/type_map.go +++ b/api/vendor/github.com/modern-go/reflect2/type_map.go @@ -1,3 +1,4 @@ +//go:build !gccgo // +build !gccgo package reflect2 @@ -9,6 +10,7 @@ import ( ) // typelinks2 for 1.7 ~ +// //go:linkname typelinks2 reflect.typelinks func typelinks2() (sections []unsafe.Pointer, offset [][]int32) diff --git a/api/vendor/github.com/modern-go/reflect2/unsafe_link.go b/api/vendor/github.com/modern-go/reflect2/unsafe_link.go index b49f614efc58..61849bb426f0 100644 --- a/api/vendor/github.com/modern-go/reflect2/unsafe_link.go +++ b/api/vendor/github.com/modern-go/reflect2/unsafe_link.go @@ -13,6 +13,7 @@ func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer // typedslicecopy copies a slice of elemType values from src to dst, // returning the number of elements copied. +// //go:linkname typedslicecopy reflect.typedslicecopy //go:noescape func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int diff --git a/api/vendor/github.com/nxadm/tail/tail.go b/api/vendor/github.com/nxadm/tail/tail.go index 37ea4411e9d6..8fa22c259609 100644 --- a/api/vendor/github.com/nxadm/tail/tail.go +++ b/api/vendor/github.com/nxadm/tail/tail.go @@ -2,11 +2,11 @@ // Copyright (c) 2015 HPE Software Inc. All rights reserved. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved. -//nxadm/tail provides a Go library that emulates the features of the BSD `tail` -//program. The library comes with full support for truncation/move detection as -//it is designed to work with log rotation tools. The library works on all -//operating systems supported by Go, including POSIX systems like Linux and -//*BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. +// nxadm/tail provides a Go library that emulates the features of the BSD `tail` +// program. The library comes with full support for truncation/move detection as +// it is designed to work with log rotation tools. The library works on all +// operating systems supported by Go, including POSIX systems like Linux and +// *BSD, and MS Windows. Go 1.9 is the oldest compiler release supported. package tail import ( diff --git a/api/vendor/github.com/nxadm/tail/tail_posix.go b/api/vendor/github.com/nxadm/tail/tail_posix.go index 23e071dea169..ca7e2404f910 100644 --- a/api/vendor/github.com/nxadm/tail/tail_posix.go +++ b/api/vendor/github.com/nxadm/tail/tail_posix.go @@ -1,4 +1,5 @@ // Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail +//go:build !windows // +build !windows package tail diff --git a/api/vendor/github.com/nxadm/tail/tail_windows.go b/api/vendor/github.com/nxadm/tail/tail_windows.go index da0d2f39c97a..0cbab7d20618 100644 --- a/api/vendor/github.com/nxadm/tail/tail_windows.go +++ b/api/vendor/github.com/nxadm/tail/tail_windows.go @@ -1,4 +1,5 @@ // Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail +//go:build windows // +build windows package tail diff --git a/api/vendor/github.com/nxadm/tail/watch/inotify.go b/api/vendor/github.com/nxadm/tail/watch/inotify.go index cbd11ad8d03c..281e6bd6e480 100644 --- a/api/vendor/github.com/nxadm/tail/watch/inotify.go +++ b/api/vendor/github.com/nxadm/tail/watch/inotify.go @@ -11,7 +11,7 @@ import ( "github.com/nxadm/tail/util" - "github.com/fsnotify/fsnotify" + "github.com/fsnotify/fsnotify" "gopkg.in/tomb.v1" ) diff --git a/api/vendor/github.com/nxadm/tail/watch/inotify_tracker.go b/api/vendor/github.com/nxadm/tail/watch/inotify_tracker.go index cb9572a03020..57da0c097333 100644 --- a/api/vendor/github.com/nxadm/tail/watch/inotify_tracker.go +++ b/api/vendor/github.com/nxadm/tail/watch/inotify_tracker.go @@ -13,7 +13,7 @@ import ( "github.com/nxadm/tail/util" - "github.com/fsnotify/fsnotify" + "github.com/fsnotify/fsnotify" ) type InotifyTracker struct { diff --git a/api/vendor/github.com/nxadm/tail/winfile/winfile.go b/api/vendor/github.com/nxadm/tail/winfile/winfile.go index 4562ac7c25c3..0c4f19900e07 100644 --- a/api/vendor/github.com/nxadm/tail/winfile/winfile.go +++ b/api/vendor/github.com/nxadm/tail/winfile/winfile.go @@ -1,4 +1,5 @@ // Copyright (c) 2019 FOSS contributors of https://github.com/nxadm/tail +//go:build windows // +build windows package winfile diff --git a/api/vendor/github.com/oklog/ulid/ulid.go b/api/vendor/github.com/oklog/ulid/ulid.go index c5d0d66fd2a4..03e62d4831da 100644 --- a/api/vendor/github.com/oklog/ulid/ulid.go +++ b/api/vendor/github.com/oklog/ulid/ulid.go @@ -376,7 +376,8 @@ func MaxTime() uint64 { return maxTime } // Now is a convenience function that returns the current // UTC time in Unix milliseconds. Equivalent to: -// Timestamp(time.Now().UTC()) +// +// Timestamp(time.Now().UTC()) func Now() uint64 { return Timestamp(time.Now().UTC()) } // Timestamp converts a time.Time to Unix milliseconds. @@ -457,7 +458,7 @@ func (id *ULID) Scan(src interface{}) error { // type can be created that calls String(). // // // stringValuer wraps a ULID as a string-based driver.Valuer. -// type stringValuer ULID +// type stringValuer ULID // // func (id stringValuer) Value() (driver.Value, error) { // return ULID(id).String(), nil diff --git a/api/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go b/api/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go index ccd7685e38ea..45291c679ac5 100644 --- a/api/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go +++ b/api/vendor/github.com/onsi/ginkgo/ginkgo_dsl.go @@ -54,40 +54,40 @@ func init() { GinkgoWriter = writer.New(os.Stdout) } -//GinkgoWriter implements an io.Writer -//When running in verbose mode any writes to GinkgoWriter will be immediately printed -//to stdout. Otherwise, GinkgoWriter will buffer any writes produced during the current test and flush them to screen -//only if the current test fails. +// GinkgoWriter implements an io.Writer +// When running in verbose mode any writes to GinkgoWriter will be immediately printed +// to stdout. Otherwise, GinkgoWriter will buffer any writes produced during the current test and flush them to screen +// only if the current test fails. var GinkgoWriter io.Writer -//The interface by which Ginkgo receives *testing.T +// The interface by which Ginkgo receives *testing.T type GinkgoTestingT interface { Fail() } -//GinkgoRandomSeed returns the seed used to randomize spec execution order. It is -//useful for seeding your own pseudorandom number generators (PRNGs) to ensure -//consistent executions from run to run, where your tests contain variability (for -//example, when selecting random test data). +// GinkgoRandomSeed returns the seed used to randomize spec execution order. It is +// useful for seeding your own pseudorandom number generators (PRNGs) to ensure +// consistent executions from run to run, where your tests contain variability (for +// example, when selecting random test data). func GinkgoRandomSeed() int64 { return config.GinkgoConfig.RandomSeed } -//GinkgoParallelNode is deprecated, use GinkgoParallelProcess instead +// GinkgoParallelNode is deprecated, use GinkgoParallelProcess instead func GinkgoParallelNode() int { deprecationTracker.TrackDeprecation(types.Deprecations.ParallelNode(), codelocation.New(1)) return GinkgoParallelProcess() } -//GinkgoParallelProcess returns the parallel process number for the current ginkgo process -//The process number is 1-indexed +// GinkgoParallelProcess returns the parallel process number for the current ginkgo process +// The process number is 1-indexed func GinkgoParallelProcess() int { return config.GinkgoConfig.ParallelNode } -//Some matcher libraries or legacy codebases require a *testing.T -//GinkgoT implements an interface analogous to *testing.T and can be used if -//the library in question accepts *testing.T through an interface +// Some matcher libraries or legacy codebases require a *testing.T +// GinkgoT implements an interface analogous to *testing.T and can be used if +// the library in question accepts *testing.T through an interface // // For example, with testify: // assert.Equal(GinkgoT(), 123, 123, "they should be equal") @@ -111,8 +111,8 @@ func GinkgoT(optionalOffset ...int) GinkgoTInterface { return testingtproxy.New(GinkgoWriter, Fail, Skip, failedFunc, nameFunc, offset) } -//The interface returned by GinkgoT(). This covers most of the methods -//in the testing package's T. +// The interface returned by GinkgoT(). This covers most of the methods +// in the testing package's T. type GinkgoTInterface interface { Cleanup(func()) Setenv(key, value string) @@ -135,17 +135,18 @@ type GinkgoTInterface interface { TempDir() string } -//Custom Ginkgo test reporters must implement the Reporter interface. +// Custom Ginkgo test reporters must implement the Reporter interface. // -//The custom reporter is passed in a SuiteSummary when the suite begins and ends, -//and a SpecSummary just before a spec begins and just after a spec ends +// The custom reporter is passed in a SuiteSummary when the suite begins and ends, +// and a SpecSummary just before a spec begins and just after a spec ends type Reporter reporters.Reporter -//Asynchronous specs are given a channel of the Done type. You must close or write to the channel -//to tell Ginkgo that your async test is done. +// Asynchronous specs are given a channel of the Done type. You must close or write to the channel +// to tell Ginkgo that your async test is done. type Done chan<- interface{} -//GinkgoTestDescription represents the information about the current running test returned by CurrentGinkgoTestDescription +// GinkgoTestDescription represents the information about the current running test returned by CurrentGinkgoTestDescription +// // FullTestText: a concatenation of ComponentTexts and the TestText // ComponentTexts: a list of all texts for the Describes & Contexts leading up to the current test // TestText: the text in the actual It or Measure node @@ -167,7 +168,7 @@ type GinkgoTestDescription struct { Duration time.Duration } -//CurrentGinkgoTestDescripton returns information about the current running test. +// CurrentGinkgoTestDescripton returns information about the current running test. func CurrentGinkgoTestDescription() GinkgoTestDescription { summary, ok := global.Suite.CurrentRunningSpecSummary() if !ok { @@ -188,26 +189,26 @@ func CurrentGinkgoTestDescription() GinkgoTestDescription { } } -//Measurement tests receive a Benchmarker. +// Measurement tests receive a Benchmarker. // -//You use the Time() function to time how long the passed in body function takes to run -//You use the RecordValue() function to track arbitrary numerical measurements. -//The RecordValueWithPrecision() function can be used alternatively to provide the unit -//and resolution of the numeric measurement. -//The optional info argument is passed to the test reporter and can be used to +// You use the Time() function to time how long the passed in body function takes to run +// You use the RecordValue() function to track arbitrary numerical measurements. +// The RecordValueWithPrecision() function can be used alternatively to provide the unit +// and resolution of the numeric measurement. +// The optional info argument is passed to the test reporter and can be used to // provide the measurement data to a custom reporter with context. // -//See http://onsi.github.io/ginkgo/#benchmark_tests for more details +// See http://onsi.github.io/ginkgo/#benchmark_tests for more details type Benchmarker interface { Time(name string, body func(), info ...interface{}) (elapsedTime time.Duration) RecordValue(name string, value float64, info ...interface{}) RecordValueWithPrecision(name string, value float64, units string, precision int, info ...interface{}) } -//RunSpecs is the entry point for the Ginkgo test runner. -//You must call this within a Golang testing TestX(t *testing.T) function. +// RunSpecs is the entry point for the Ginkgo test runner. +// You must call this within a Golang testing TestX(t *testing.T) function. // -//To bootstrap a test suite you can use the Ginkgo CLI: +// To bootstrap a test suite you can use the Ginkgo CLI: // // ginkgo bootstrap func RunSpecs(t GinkgoTestingT, description string) bool { @@ -220,16 +221,16 @@ func RunSpecs(t GinkgoTestingT, description string) bool { return runSpecsWithCustomReporters(t, description, specReporters) } -//To run your tests with Ginkgo's default reporter and your custom reporter(s), replace -//RunSpecs() with this method. +// To run your tests with Ginkgo's default reporter and your custom reporter(s), replace +// RunSpecs() with this method. func RunSpecsWithDefaultAndCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter()) specReporters = append(specReporters, buildDefaultReporter()) return runSpecsWithCustomReporters(t, description, specReporters) } -//To run your tests with your custom reporter(s) (and *not* Ginkgo's default reporter), replace -//RunSpecs() with this method. Note that parallel tests will not work correctly without the default reporter +// To run your tests with your custom reporter(s) (and *not* Ginkgo's default reporter), replace +// RunSpecs() with this method. Note that parallel tests will not work correctly without the default reporter func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specReporters []Reporter) bool { deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter()) return runSpecsWithCustomReporters(t, description, specReporters) @@ -269,7 +270,7 @@ func buildDefaultReporter() Reporter { } } -//Skip notifies Ginkgo that the current spec was skipped. +// Skip notifies Ginkgo that the current spec was skipped. func Skip(message string, callerSkip ...int) { skip := 0 if len(callerSkip) > 0 { @@ -280,7 +281,7 @@ func Skip(message string, callerSkip ...int) { panic(GINKGO_PANIC) } -//Fail notifies Ginkgo that the current spec has failed. (Gomega will call Fail for you automatically when an assertion fails.) +// Fail notifies Ginkgo that the current spec has failed. (Gomega will call Fail for you automatically when an assertion fails.) func Fail(message string, callerSkip ...int) { skip := 0 if len(callerSkip) > 0 { @@ -291,16 +292,16 @@ func Fail(message string, callerSkip ...int) { panic(GINKGO_PANIC) } -//GinkgoRecover should be deferred at the top of any spawned goroutine that (may) call `Fail` -//Since Gomega assertions call fail, you should throw a `defer GinkgoRecover()` at the top of any goroutine that -//calls out to Gomega +// GinkgoRecover should be deferred at the top of any spawned goroutine that (may) call `Fail` +// Since Gomega assertions call fail, you should throw a `defer GinkgoRecover()` at the top of any goroutine that +// calls out to Gomega // -//Here's why: Ginkgo's `Fail` method records the failure and then panics to prevent -//further assertions from running. This panic must be recovered. Ginkgo does this for you -//if the panic originates in a Ginkgo node (an It, BeforeEach, etc...) +// Here's why: Ginkgo's `Fail` method records the failure and then panics to prevent +// further assertions from running. This panic must be recovered. Ginkgo does this for you +// if the panic originates in a Ginkgo node (an It, BeforeEach, etc...) // -//Unfortunately, if a panic originates on a goroutine *launched* from one of these nodes there's no -//way for Ginkgo to rescue the panic. To do this, you must remember to `defer GinkgoRecover()` at the top of such a goroutine. +// Unfortunately, if a panic originates on a goroutine *launched* from one of these nodes there's no +// way for Ginkgo to rescue the panic. To do this, you must remember to `defer GinkgoRecover()` at the top of such a goroutine. func GinkgoRecover() { e := recover() if e != nil { @@ -308,158 +309,158 @@ func GinkgoRecover() { } } -//Describe blocks allow you to organize your specs. A Describe block can contain any number of -//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. +// Describe blocks allow you to organize your specs. A Describe block can contain any number of +// BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. // -//In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally -//equivalent. The difference is purely semantic -- you typically Describe the behavior of an object -//or method and, within that Describe, outline a number of Contexts and Whens. +// In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally +// equivalent. The difference is purely semantic -- you typically Describe the behavior of an object +// or method and, within that Describe, outline a number of Contexts and Whens. func Describe(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) return true } -//You can focus the tests within a describe block using FDescribe +// You can focus the tests within a describe block using FDescribe func FDescribe(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using PDescribe +// You can mark the tests within a describe block as pending using PDescribe func PDescribe(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using XDescribe +// You can mark the tests within a describe block as pending using XDescribe func XDescribe(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) return true } -//Context blocks allow you to organize your specs. A Context block can contain any number of -//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. +// Context blocks allow you to organize your specs. A Context block can contain any number of +// BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. // -//In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally -//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object -//or method and, within that Describe, outline a number of Contexts and Whens. +// In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally +// equivalent. The difference is purely semantic -- you typical Describe the behavior of an object +// or method and, within that Describe, outline a number of Contexts and Whens. func Context(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1)) return true } -//You can focus the tests within a describe block using FContext +// You can focus the tests within a describe block using FContext func FContext(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypeFocused, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using PContext +// You can mark the tests within a describe block as pending using PContext func PContext(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using XContext +// You can mark the tests within a describe block as pending using XContext func XContext(text string, body func()) bool { global.Suite.PushContainerNode(text, body, types.FlagTypePending, codelocation.New(1)) return true } -//When blocks allow you to organize your specs. A When block can contain any number of -//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. +// When blocks allow you to organize your specs. A When block can contain any number of +// BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks. // -//In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally -//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object -//or method and, within that Describe, outline a number of Contexts and Whens. +// In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally +// equivalent. The difference is purely semantic -- you typical Describe the behavior of an object +// or method and, within that Describe, outline a number of Contexts and Whens. func When(text string, body func()) bool { global.Suite.PushContainerNode("when "+text, body, types.FlagTypeNone, codelocation.New(1)) return true } -//You can focus the tests within a describe block using FWhen +// You can focus the tests within a describe block using FWhen func FWhen(text string, body func()) bool { global.Suite.PushContainerNode("when "+text, body, types.FlagTypeFocused, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using PWhen +// You can mark the tests within a describe block as pending using PWhen func PWhen(text string, body func()) bool { global.Suite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1)) return true } -//You can mark the tests within a describe block as pending using XWhen +// You can mark the tests within a describe block as pending using XWhen func XWhen(text string, body func()) bool { global.Suite.PushContainerNode("when "+text, body, types.FlagTypePending, codelocation.New(1)) return true } -//It blocks contain your test code and assertions. You cannot nest any other Ginkgo blocks -//within an It block. +// It blocks contain your test code and assertions. You cannot nest any other Ginkgo blocks +// within an It block. // -//Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a -//function that accepts a Done channel. When you do this, you can also provide an optional timeout. +// Ginkgo will normally run It blocks synchronously. To perform asynchronous tests, pass a +// function that accepts a Done channel. When you do this, you can also provide an optional timeout. func It(text string, body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) return true } -//You can focus individual Its using FIt +// You can focus individual Its using FIt func FIt(text string, body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) return true } -//You can mark Its as pending using PIt +// You can mark Its as pending using PIt func PIt(text string, _ ...interface{}) bool { global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//You can mark Its as pending using XIt +// You can mark Its as pending using XIt func XIt(text string, _ ...interface{}) bool { global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//Specify blocks are aliases for It blocks and allow for more natural wording in situations -//which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks -//which apply to It blocks. +// Specify blocks are aliases for It blocks and allow for more natural wording in situations +// which "It" does not fit into a natural sentence flow. All the same protocols apply for Specify blocks +// which apply to It blocks. func Specify(text string, body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeNone, codelocation.New(1), parseTimeout(timeout...)) return true } -//You can focus individual Specifys using FSpecify +// You can focus individual Specifys using FSpecify func FSpecify(text string, body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushItNode(text, body, types.FlagTypeFocused, codelocation.New(1), parseTimeout(timeout...)) return true } -//You can mark Specifys as pending using PSpecify +// You can mark Specifys as pending using PSpecify func PSpecify(text string, is ...interface{}) bool { global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//You can mark Specifys as pending using XSpecify +// You can mark Specifys as pending using XSpecify func XSpecify(text string, is ...interface{}) bool { global.Suite.PushItNode(text, func() {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//By allows you to better document large Its. +// By allows you to better document large Its. // -//Generally you should try to keep your Its short and to the point. This is not always possible, however, -//especially in the context of integration tests that capture a particular workflow. +// Generally you should try to keep your Its short and to the point. This is not always possible, however, +// especially in the context of integration tests that capture a particular workflow. // -//By allows you to document such flows. By must be called within a runnable node (It, BeforeEach, Measure, etc...) -//By will simply log the passed in text to the GinkgoWriter. If By is handed a function it will immediately run the function. +// By allows you to document such flows. By must be called within a runnable node (It, BeforeEach, Measure, etc...) +// By will simply log the passed in text to the GinkgoWriter. If By is handed a function it will immediately run the function. func By(text string, callbacks ...func()) { preamble := "\x1b[1mSTEP\x1b[0m" if config.DefaultReporterConfig.NoColor { @@ -474,10 +475,11 @@ func By(text string, callbacks ...func()) { } } -//Measure blocks run the passed in body function repeatedly (determined by the samples argument) -//and accumulate metrics provided to the Benchmarker by the body function. +// Measure blocks run the passed in body function repeatedly (determined by the samples argument) +// and accumulate metrics provided to the Benchmarker by the body function. +// +// The body function must have the signature: // -//The body function must have the signature: // func(b Benchmarker) func Measure(text string, body interface{}, samples int) bool { deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) @@ -485,79 +487,79 @@ func Measure(text string, body interface{}, samples int) bool { return true } -//You can focus individual Measures using FMeasure +// You can focus individual Measures using FMeasure func FMeasure(text string, body interface{}, samples int) bool { deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, body, types.FlagTypeFocused, codelocation.New(1), samples) return true } -//You can mark Measurements as pending using PMeasure +// You can mark Measurements as pending using PMeasure func PMeasure(text string, _ ...interface{}) bool { deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//You can mark Measurements as pending using XMeasure +// You can mark Measurements as pending using XMeasure func XMeasure(text string, _ ...interface{}) bool { deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), codelocation.New(1)) global.Suite.PushMeasureNode(text, func(b Benchmarker) {}, types.FlagTypePending, codelocation.New(1), 0) return true } -//BeforeSuite blocks are run just once before any specs are run. When running in parallel, each -//parallel node process will call BeforeSuite. +// BeforeSuite blocks are run just once before any specs are run. When running in parallel, each +// parallel node process will call BeforeSuite. // -//BeforeSuite blocks can be made asynchronous by providing a body function that accepts a Done channel +// # BeforeSuite blocks can be made asynchronous by providing a body function that accepts a Done channel // -//You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level. +// You may only register *one* BeforeSuite handler per test suite. You typically do so in your bootstrap file at the top level. func BeforeSuite(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.SetBeforeSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } -//AfterSuite blocks are *always* run after all the specs regardless of whether specs have passed or failed. -//Moreover, if Ginkgo receives an interrupt signal (^C) it will attempt to run the AfterSuite before exiting. +// AfterSuite blocks are *always* run after all the specs regardless of whether specs have passed or failed. +// Moreover, if Ginkgo receives an interrupt signal (^C) it will attempt to run the AfterSuite before exiting. // -//When running in parallel, each parallel node process will call AfterSuite. +// When running in parallel, each parallel node process will call AfterSuite. // -//AfterSuite blocks can be made asynchronous by providing a body function that accepts a Done channel +// # AfterSuite blocks can be made asynchronous by providing a body function that accepts a Done channel // -//You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level. +// You may only register *one* AfterSuite handler per test suite. You typically do so in your bootstrap file at the top level. func AfterSuite(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.SetAfterSuiteNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } -//SynchronizedBeforeSuite blocks are primarily meant to solve the problem of setting up singleton external resources shared across -//nodes when running tests in parallel. For example, say you have a shared database that you can only start one instance of that -//must be used in your tests. When running in parallel, only one node should set up the database and all other nodes should wait -//until that node is done before running. +// SynchronizedBeforeSuite blocks are primarily meant to solve the problem of setting up singleton external resources shared across +// nodes when running tests in parallel. For example, say you have a shared database that you can only start one instance of that +// must be used in your tests. When running in parallel, only one node should set up the database and all other nodes should wait +// until that node is done before running. // -//SynchronizedBeforeSuite accomplishes this by taking *two* function arguments. The first is only run on parallel node #1. The second is -//run on all nodes, but *only* after the first function completes successfully. Ginkgo also makes it possible to send data from the first function (on Node 1) -//to the second function (on all the other nodes). +// SynchronizedBeforeSuite accomplishes this by taking *two* function arguments. The first is only run on parallel node #1. The second is +// run on all nodes, but *only* after the first function completes successfully. Ginkgo also makes it possible to send data from the first function (on Node 1) +// to the second function (on all the other nodes). // -//The functions have the following signatures. The first function (which only runs on node 1) has the signature: +// The functions have the following signatures. The first function (which only runs on node 1) has the signature: // // func() []byte // -//or, to run asynchronously: +// or, to run asynchronously: // // func(done Done) []byte // -//The byte array returned by the first function is then passed to the second function, which has the signature: +// The byte array returned by the first function is then passed to the second function, which has the signature: // // func(data []byte) // -//or, to run asynchronously: +// or, to run asynchronously: // // func(data []byte, done Done) // -//Here's a simple pseudo-code example that starts a shared database on Node 1 and shares the database's address with the other nodes: +// Here's a simple pseudo-code example that starts a shared database on Node 1 and shares the database's address with the other nodes: // // var dbClient db.Client // var dbRunner db.Runner @@ -582,17 +584,17 @@ func SynchronizedBeforeSuite(node1Body interface{}, allNodesBody interface{}, ti return true } -//SynchronizedAfterSuite blocks complement the SynchronizedBeforeSuite blocks in solving the problem of setting up -//external singleton resources shared across nodes when running tests in parallel. +// SynchronizedAfterSuite blocks complement the SynchronizedBeforeSuite blocks in solving the problem of setting up +// external singleton resources shared across nodes when running tests in parallel. // -//SynchronizedAfterSuite accomplishes this by taking *two* function arguments. The first runs on all nodes. The second runs only on parallel node #1 -//and *only* after all other nodes have finished and exited. This ensures that node 1, and any resources it is running, remain alive until -//all other nodes are finished. +// SynchronizedAfterSuite accomplishes this by taking *two* function arguments. The first runs on all nodes. The second runs only on parallel node #1 +// and *only* after all other nodes have finished and exited. This ensures that node 1, and any resources it is running, remain alive until +// all other nodes are finished. // -//Both functions have the same signature: either func() or func(done Done) to run asynchronously. +// Both functions have the same signature: either func() or func(done Done) to run asynchronously. // -//Here's a pseudo-code example that complements that given in SynchronizedBeforeSuite. Here, SynchronizedAfterSuite is used to tear down the shared database -//only after all nodes have finished: +// Here's a pseudo-code example that complements that given in SynchronizedBeforeSuite. Here, SynchronizedAfterSuite is used to tear down the shared database +// only after all nodes have finished: // // var _ = SynchronizedAfterSuite(func() { // dbClient.Cleanup() @@ -609,44 +611,44 @@ func SynchronizedAfterSuite(allNodesBody interface{}, node1Body interface{}, tim return true } -//BeforeEach blocks are run before It blocks. When multiple BeforeEach blocks are defined in nested -//Describe and Context blocks the outermost BeforeEach blocks are run first. +// BeforeEach blocks are run before It blocks. When multiple BeforeEach blocks are defined in nested +// Describe and Context blocks the outermost BeforeEach blocks are run first. // -//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts -//a Done channel +// Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts +// a Done channel func BeforeEach(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } -//JustBeforeEach blocks are run before It blocks but *after* all BeforeEach blocks. For more details, -//read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) +// JustBeforeEach blocks are run before It blocks but *after* all BeforeEach blocks. For more details, +// read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) // -//Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts -//a Done channel +// Like It blocks, BeforeEach blocks can be made asynchronous by providing a body function that accepts +// a Done channel func JustBeforeEach(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushJustBeforeEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } -//JustAfterEach blocks are run after It blocks but *before* all AfterEach blocks. For more details, -//read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) +// JustAfterEach blocks are run after It blocks but *before* all AfterEach blocks. For more details, +// read the [documentation](http://onsi.github.io/ginkgo/#separating_creation_and_configuration_) // -//Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts -//a Done channel +// Like It blocks, JustAfterEach blocks can be made asynchronous by providing a body function that accepts +// a Done channel func JustAfterEach(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushJustAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) return true } -//AfterEach blocks are run after It blocks. When multiple AfterEach blocks are defined in nested -//Describe and Context blocks the innermost AfterEach blocks are run first. +// AfterEach blocks are run after It blocks. When multiple AfterEach blocks are defined in nested +// Describe and Context blocks the innermost AfterEach blocks are run first. // -//Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts -//a Done channel +// Like It blocks, AfterEach blocks can be made asynchronous by providing a body function that accepts +// a Done channel func AfterEach(body interface{}, timeout ...float64) bool { validateBodyFunc(body, codelocation.New(1)) global.Suite.PushAfterEachNode(body, codelocation.New(1), parseTimeout(timeout...)) diff --git a/api/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go b/api/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go index 992437d9e0bd..a4deca99ce1f 100644 --- a/api/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go +++ b/api/vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go @@ -1,5 +1,4 @@ /* - Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete. You shouldn't need to use this in your code. To run tests in parallel: diff --git a/api/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go b/api/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go index 284bc62e5e89..e383841b7131 100644 --- a/api/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go +++ b/api/vendor/github.com/onsi/ginkgo/internal/remote/forwarding_reporter.go @@ -16,7 +16,7 @@ import ( "github.com/onsi/ginkgo/types" ) -//An interface to net/http's client to allow the injection of fakes under test +// An interface to net/http's client to allow the injection of fakes under test type Poster interface { Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error) } diff --git a/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go b/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go index 774967db66b7..cdfdaa819b0b 100644 --- a/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go +++ b/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_unix.go @@ -1,3 +1,4 @@ +//go:build freebsd || openbsd || netbsd || dragonfly || darwin || linux || solaris // +build freebsd openbsd netbsd dragonfly darwin linux solaris package remote diff --git a/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go b/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go index 40c790336ccf..5d088101e10c 100644 --- a/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go +++ b/api/vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package remote diff --git a/api/vendor/github.com/onsi/ginkgo/internal/remote/server.go b/api/vendor/github.com/onsi/ginkgo/internal/remote/server.go index 93e9dac057de..d9375cd3a802 100644 --- a/api/vendor/github.com/onsi/ginkgo/internal/remote/server.go +++ b/api/vendor/github.com/onsi/ginkgo/internal/remote/server.go @@ -35,7 +35,7 @@ type Server struct { counter int } -//Create a new server, automatically selecting a port +// Create a new server, automatically selecting a port func NewServer(parallelTotal int) (*Server, error) { listener, err := net.Listen("tcp", "127.0.0.1:0") if err != nil { @@ -50,7 +50,7 @@ func NewServer(parallelTotal int) (*Server, error) { }, nil } -//Start the server. You don't need to `go s.Start()`, just `s.Start()` +// Start the server. You don't need to `go s.Start()`, just `s.Start()` func (server *Server) Start() { httpServer := &http.Server{} mux := http.NewServeMux() @@ -73,12 +73,12 @@ func (server *Server) Start() { go httpServer.Serve(server.listener) } -//Stop the server +// Stop the server func (server *Server) Close() { server.listener.Close() } -//The address the server can be reached it. Pass this into the `ForwardingReporter`. +// The address the server can be reached it. Pass this into the `ForwardingReporter`. func (server *Server) Address() string { return "http://" + server.listener.Addr().String() } @@ -87,7 +87,7 @@ func (server *Server) Address() string { // Streaming Endpoints // -//The server will forward all received messages to Ginkgo reporters registered with `RegisterReporters` +// The server will forward all received messages to Ginkgo reporters registered with `RegisterReporters` func (server *Server) readAll(request *http.Request) []byte { defer request.Body.Close() body, _ := ioutil.ReadAll(request.Body) diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go b/api/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go index 27db47949081..bf3af17c4f58 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go @@ -5,7 +5,7 @@ import ( "github.com/onsi/ginkgo/types" ) -//FakeReporter is useful for testing purposes +// FakeReporter is useful for testing purposes type FakeReporter struct { Config config.GinkgoConfigType diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go b/api/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go index 01ddca6e1dfc..f19c760b51ac 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go @@ -55,7 +55,7 @@ type JUnitReporter struct { ReporterConfig config.DefaultReporterConfigType } -//NewJUnitReporter creates a new JUnit XML reporter. The XML will be stored in the passed in filename. +// NewJUnitReporter creates a new JUnit XML reporter. The XML will be stored in the passed in filename. func NewJUnitReporter(filename string) *JUnitReporter { return &JUnitReporter{ filename: filename, @@ -160,7 +160,7 @@ func (reporter *JUnitReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { if err == nil { fmt.Fprintf(os.Stdout, "\nJUnit report was created: %s\n", filePath) } else { - fmt.Fprintf(os.Stderr,"\nFailed to generate JUnit report data:\n\t%s", err.Error()) + fmt.Fprintf(os.Stderr, "\nFailed to generate JUnit report data:\n\t%s", err.Error()) } } diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go index 52d6653b34bb..3fb5bf158993 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/colorable_others.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package colorable diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go index 83c588773cf1..84eabda78f82 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go @@ -1,3 +1,4 @@ +//go:build appengine // +build appengine package isatty diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go index 98ffe86a4bac..5cb68df6c771 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_bsd.go @@ -1,3 +1,4 @@ +//go:build (darwin || freebsd || openbsd || netbsd) && !appengine // +build darwin freebsd openbsd netbsd // +build !appengine diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go index 9d24bac1db35..873523f42935 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_linux.go @@ -1,5 +1,5 @@ -// +build linux -// +build !appengine +//go:build linux && !appengine +// +build linux,!appengine package isatty diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go index 1f0c6bf53dce..fb80b296692b 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_solaris.go @@ -1,5 +1,5 @@ -// +build solaris -// +build !appengine +//go:build solaris && !appengine +// +build solaris,!appengine package isatty diff --git a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go index 83c398b16db4..89fc3d02b22b 100644 --- a/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go +++ b/api/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_windows.go @@ -1,5 +1,5 @@ -// +build windows -// +build !appengine +//go:build windows && !appengine +// +build windows,!appengine package isatty diff --git a/api/vendor/github.com/openshift/api/config/v1/types_cluster_version.go b/api/vendor/github.com/openshift/api/config/v1/types_cluster_version.go index 234720477b7f..1ba959816ee1 100644 --- a/api/vendor/github.com/openshift/api/config/v1/types_cluster_version.go +++ b/api/vendor/github.com/openshift/api/config/v1/types_cluster_version.go @@ -488,8 +488,8 @@ type ComponentOverride struct { type URL string // Update represents an administrator update request. -// +kubebuilder:validation:XValidation:rule="has(self.architecture) && has(self.image) ? (self.architecture == '' || self.image == '') : true",message="cannot set both Architecture and Image" -// +kubebuilder:validation:XValidation:rule="has(self.architecture) && self.architecture != '' ? self.version != '' : true",message="Version must be set if Architecture is set" +// +kubebuilder:validation:XValidation:rule="has(self.architecture) && has(self.image) ? (self.architecture == ” || self.image == ”) : true",message="cannot set both Architecture and Image" +// +kubebuilder:validation:XValidation:rule="has(self.architecture) && self.architecture != ” ? self.version != ” : true",message="Version must be set if Architecture is set" // +k8s:deepcopy-gen=true type Update struct { // architecture is an optional field that indicates the desired diff --git a/api/vendor/github.com/openshift/api/config/v1/types_tlssecurityprofile.go b/api/vendor/github.com/openshift/api/config/v1/types_tlssecurityprofile.go index 9dbacb996681..fa03072bbe49 100644 --- a/api/vendor/github.com/openshift/api/config/v1/types_tlssecurityprofile.go +++ b/api/vendor/github.com/openshift/api/config/v1/types_tlssecurityprofile.go @@ -177,7 +177,7 @@ type TLSProfileSpec struct { // TLSProtocolVersion is a way to specify the protocol version used for TLS connections. // Protocol versions are based on the following most common TLS configurations: // -// https://ssl-config.mozilla.org/ +// https://ssl-config.mozilla.org/ // // Note that SSLv3.0 is not a supported protocol version due to well known // vulnerabilities such as POODLE: https://en.wikipedia.org/wiki/POODLE diff --git a/api/vendor/github.com/openshift/custom-resource-status/conditions/v1/zz_generated.deepcopy.go b/api/vendor/github.com/openshift/custom-resource-status/conditions/v1/zz_generated.deepcopy.go index bbbbf863d137..b9b6e6d65731 100644 --- a/api/vendor/github.com/openshift/custom-resource-status/conditions/v1/zz_generated.deepcopy.go +++ b/api/vendor/github.com/openshift/custom-resource-status/conditions/v1/zz_generated.deepcopy.go @@ -1,3 +1,4 @@ +//go:build !ignore_autogenerated // +build !ignore_autogenerated // Code generated by deepcopy-gen. DO NOT EDIT. diff --git a/api/vendor/github.com/pkg/errors/errors.go b/api/vendor/github.com/pkg/errors/errors.go index 161aea258296..5d90dd4cc18a 100644 --- a/api/vendor/github.com/pkg/errors/errors.go +++ b/api/vendor/github.com/pkg/errors/errors.go @@ -2,89 +2,89 @@ // // The traditional error handling idiom in Go is roughly akin to // -// if err != nil { -// return err -// } +// if err != nil { +// return err +// } // // which when applied recursively up the call stack results in error reports // without context or debugging information. The errors package allows // programmers to add context to the failure path in their code in a way // that does not destroy the original value of the error. // -// Adding context to an error +// # Adding context to an error // // The errors.Wrap function returns a new error that adds context to the // original error by recording a stack trace at the point Wrap is called, // together with the supplied message. For example // -// _, err := ioutil.ReadAll(r) -// if err != nil { -// return errors.Wrap(err, "read failed") -// } +// _, err := ioutil.ReadAll(r) +// if err != nil { +// return errors.Wrap(err, "read failed") +// } // // If additional control is required, the errors.WithStack and // errors.WithMessage functions destructure errors.Wrap into its component // operations: annotating an error with a stack trace and with a message, // respectively. // -// Retrieving the cause of an error +// # Retrieving the cause of an error // // Using errors.Wrap constructs a stack of errors, adding context to the // preceding error. Depending on the nature of the error it may be necessary // to reverse the operation of errors.Wrap to retrieve the original error // for inspection. Any error value which implements this interface // -// type causer interface { -// Cause() error -// } +// type causer interface { +// Cause() error +// } // // can be inspected by errors.Cause. errors.Cause will recursively retrieve // the topmost error that does not implement causer, which is assumed to be // the original cause. For example: // -// switch err := errors.Cause(err).(type) { -// case *MyError: -// // handle specifically -// default: -// // unknown error -// } +// switch err := errors.Cause(err).(type) { +// case *MyError: +// // handle specifically +// default: +// // unknown error +// } // // Although the causer interface is not exported by this package, it is // considered a part of its stable public interface. // -// Formatted printing of errors +// # Formatted printing of errors // // All error values returned from this package implement fmt.Formatter and can // be formatted by the fmt package. The following verbs are supported: // -// %s print the error. If the error has a Cause it will be -// printed recursively. -// %v see %s -// %+v extended format. Each Frame of the error's StackTrace will -// be printed in detail. +// %s print the error. If the error has a Cause it will be +// printed recursively. +// %v see %s +// %+v extended format. Each Frame of the error's StackTrace will +// be printed in detail. // -// Retrieving the stack trace of an error or wrapper +// # Retrieving the stack trace of an error or wrapper // // New, Errorf, Wrap, and Wrapf record a stack trace at the point they are // invoked. This information can be retrieved with the following interface: // -// type stackTracer interface { -// StackTrace() errors.StackTrace -// } +// type stackTracer interface { +// StackTrace() errors.StackTrace +// } // // The returned errors.StackTrace type is defined as // -// type StackTrace []Frame +// type StackTrace []Frame // // The Frame type represents a call site in the stack trace. Frame supports // the fmt.Formatter interface that can be used for printing information about // the stack trace of this error. For example: // -// if err, ok := err.(stackTracer); ok { -// for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d\n", f, f) -// } -// } +// if err, ok := err.(stackTracer); ok { +// for _, f := range err.StackTrace() { +// fmt.Printf("%+s:%d\n", f, f) +// } +// } // // Although the stackTracer interface is not exported by this package, it is // considered a part of its stable public interface. @@ -265,9 +265,9 @@ func (w *withMessage) Format(s fmt.State, verb rune) { // An error value has a cause if it implements the following // interface: // -// type causer interface { -// Cause() error -// } +// type causer interface { +// Cause() error +// } // // If the error does not implement Cause, the original error will // be returned. If the error is nil, nil will be returned without further diff --git a/api/vendor/github.com/pkg/errors/go113.go b/api/vendor/github.com/pkg/errors/go113.go index be0d10d0c793..2c83c724532f 100644 --- a/api/vendor/github.com/pkg/errors/go113.go +++ b/api/vendor/github.com/pkg/errors/go113.go @@ -1,3 +1,4 @@ +//go:build go1.13 // +build go1.13 package errors diff --git a/api/vendor/github.com/pkg/errors/stack.go b/api/vendor/github.com/pkg/errors/stack.go index 779a8348fb9c..82784d70036b 100644 --- a/api/vendor/github.com/pkg/errors/stack.go +++ b/api/vendor/github.com/pkg/errors/stack.go @@ -51,16 +51,16 @@ func (f Frame) name() string { // Format formats the frame according to the fmt.Formatter interface. // -// %s source file -// %d source line -// %n function name -// %v equivalent to %s:%d +// %s source file +// %d source line +// %n function name +// %v equivalent to %s:%d // // Format accepts flags that alter the printing of some verbs, as follows: // -// %+s function name and path of source file relative to the compile time -// GOPATH separated by \n\t (\n\t) -// %+v equivalent to %+s:%d +// %+s function name and path of source file relative to the compile time +// GOPATH separated by \n\t (\n\t) +// %+v equivalent to %+s:%d func (f Frame) Format(s fmt.State, verb rune) { switch verb { case 's': @@ -98,12 +98,12 @@ type StackTrace []Frame // Format formats the stack of Frames according to the fmt.Formatter interface. // -// %s lists source files for each Frame in the stack -// %v lists the source file and line number for each Frame in the stack +// %s lists source files for each Frame in the stack +// %v lists the source file and line number for each Frame in the stack // // Format accepts flags that alter the printing of some verbs, as follows: // -// %+v Prints filename, function, and line number for each Frame in the stack. +// %+v Prints filename, function, and line number for each Frame in the stack. func (st StackTrace) Format(s fmt.State, verb rune) { switch verb { case 'v': diff --git a/api/vendor/github.com/spf13/pflag/flag.go b/api/vendor/github.com/spf13/pflag/flag.go index 7c058de3744a..02de50a0b22d 100644 --- a/api/vendor/github.com/spf13/pflag/flag.go +++ b/api/vendor/github.com/spf13/pflag/flag.go @@ -27,23 +27,32 @@ unaffected. Define flags using flag.String(), Bool(), Int(), etc. This declares an integer flag, -flagname, stored in the pointer ip, with type *int. + var ip = flag.Int("flagname", 1234, "help message for flagname") + If you like, you can bind the flag to a variable using the Var() functions. + var flagvar int func init() { flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname") } + Or you can create custom flags that satisfy the Value interface (with pointer receivers) and couple them to flag parsing by + flag.Var(&flagVal, "name", "help message for flagname") + For such flags, the default value is just the initial value of the variable. After all flags are defined, call + flag.Parse() + to parse the command line into the defined flags. Flags may then be used directly. If you're using the flags themselves, they are all pointers; if you bind to variables, they're values. + fmt.Println("ip has value ", *ip) fmt.Println("flagvar has value ", flagvar) @@ -54,22 +63,26 @@ The arguments are indexed from 0 through flag.NArg()-1. The pflag package also defines some new functions that are not in flag, that give one-letter shorthands for flags. You can use these by appending 'P' to the name of any function that defines a flag. + var ip = flag.IntP("flagname", "f", 1234, "help message") var flagvar bool func init() { flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") } flag.VarP(&flagval, "varname", "v", "help message") + Shorthand letters can be used with single dashes on the command line. Boolean shorthand flags can be combined with other shorthand flags. Command line flag syntax: + --flag // boolean flags only --flag=x Unlike the flag package, a single dash before an option means something different than a double dash. Single dashes signify a series of shorthand letters for flags. All but the last shorthand letter must be boolean flags. + // boolean flags -f -abc @@ -934,9 +947,9 @@ func (f *FlagSet) usage() { } } -//--unknown (args will be empty) -//--unknown --next-flag ... (args will be --next-flag ...) -//--unknown arg ... (args will be arg ...) +// --unknown (args will be empty) +// --unknown --next-flag ... (args will be --next-flag ...) +// --unknown arg ... (args will be arg ...) func stripUnknownFlagValue(args []string) []string { if len(args) == 0 { //--unknown diff --git a/api/vendor/github.com/spf13/pflag/string_slice.go b/api/vendor/github.com/spf13/pflag/string_slice.go index 3cb2e69dba02..d421887e8672 100644 --- a/api/vendor/github.com/spf13/pflag/string_slice.go +++ b/api/vendor/github.com/spf13/pflag/string_slice.go @@ -98,9 +98,12 @@ func (f *FlagSet) GetStringSlice(name string) ([]string, error) { // The argument p points to a []string variable in which to store the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { f.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -114,9 +117,12 @@ func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []s // The argument p points to a []string variable in which to store the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func StringSliceVar(p *[]string, name string, value []string, usage string) { CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -130,9 +136,12 @@ func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage // The return value is the address of a []string variable that stores the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { p := []string{} f.StringSliceVarP(&p, name, "", value, usage) @@ -150,9 +159,12 @@ func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage str // The return value is the address of a []string variable that stores the value of the flag. // Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. // For example: -// --ss="v1,v2" --ss="v3" +// +// --ss="v1,v2" --ss="v3" +// // will result in -// []string{"v1", "v2", "v3"} +// +// []string{"v1", "v2", "v3"} func StringSlice(name string, value []string, usage string) *[]string { return CommandLine.StringSliceP(name, "", value, usage) } diff --git a/api/vendor/github.com/thoas/go-funk/builder.go b/api/vendor/github.com/thoas/go-funk/builder.go index 6dfc814d7324..c66ac9427b20 100644 --- a/api/vendor/github.com/thoas/go-funk/builder.go +++ b/api/vendor/github.com/thoas/go-funk/builder.go @@ -46,7 +46,7 @@ type Builder interface { Values() interface{} } -// Chain creates a simple new go-funk.Builder from a collection. Each method +// Chain creates a simple new go-funk.Builder from a collection. Each method // call generate a new builder containing the previous result. func Chain(v interface{}) Builder { isNotNil(v, "Chain") @@ -76,10 +76,10 @@ func LazyChain(v interface{}) Builder { } -// LazyChainWith creates a lazy go-funk.Builder from a generator. Like LazyChain, each +// LazyChainWith creates a lazy go-funk.Builder from a generator. Like LazyChain, each // method call generate a new builder containing a method generating the previous value. // But, instead of using a collection, it takes a generator which can generate values. -// With LazyChainWith, to can create a generic pipeline of collection transformation and, +// With LazyChainWith, to can create a generic pipeline of collection transformation and, // throw the generator, sending different collection. func LazyChainWith(generator func() interface{}) Builder { isNotNil(generator, "LazyChainWith") diff --git a/api/vendor/github.com/thoas/go-funk/subset.go b/api/vendor/github.com/thoas/go-funk/subset.go index de47be151762..c88d00884fc0 100644 --- a/api/vendor/github.com/thoas/go-funk/subset.go +++ b/api/vendor/github.com/thoas/go-funk/subset.go @@ -37,5 +37,5 @@ func Subset(x interface{}, y interface{}) bool { } } - return true + return true } diff --git a/api/vendor/github.com/thoas/go-funk/utils.go b/api/vendor/github.com/thoas/go-funk/utils.go index 43d9a2be73a9..4492317634b4 100644 --- a/api/vendor/github.com/thoas/go-funk/utils.go +++ b/api/vendor/github.com/thoas/go-funk/utils.go @@ -9,7 +9,8 @@ func equal(expectedOrPredicate interface{}, optionalIsMap ...bool) func(keyValue isMap := append(optionalIsMap, false)[0] if IsFunction(expectedOrPredicate) { - inTypes := []reflect.Type{nil}; if isMap { + inTypes := []reflect.Type{nil} + if isMap { inTypes = append(inTypes, nil) } diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/bson.go b/api/vendor/go.mongodb.org/mongo-driver/bson/bson.go index 95ffc1078da1..a0d818582611 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/bson.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/bson.go @@ -27,7 +27,7 @@ type Zeroer interface { // // Example usage: // -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} type D = primitive.D // E represents a BSON element for a D. It is usually used inside a D. @@ -39,12 +39,12 @@ type E = primitive.E // // Example usage: // -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} type M = primitive.M // An A is an ordered representation of a BSON array. // // Example usage: // -// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} +// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} type A = primitive.A diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go index b0ae0e23ff2e..5f903ebea6c9 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go @@ -17,7 +17,7 @@ // 2) A Registry that holds these ValueEncoders and ValueDecoders and provides methods for // retrieving them. // -// ValueEncoders and ValueDecoders +// # ValueEncoders and ValueDecoders // // The ValueEncoder interface is implemented by types that can encode a provided Go type to BSON. // The value to encode is provided as a reflect.Value and a bsonrw.ValueWriter is used within the @@ -31,7 +31,7 @@ // allow the use of a function with the correct signature as a ValueDecoder. A DecodeContext // instance is provided and serves similar functionality to the EncodeContext. // -// Registry and RegistryBuilder +// # Registry and RegistryBuilder // // A Registry is an immutable store for ValueEncoders, ValueDecoders, and a type map. See the Registry type // documentation for examples of registering various custom encoders and decoders. A Registry can be constructed using a @@ -53,15 +53,15 @@ // values decode as Go int32 and int64 instances, respectively, when decoding into a bson.D. The following code would // change the behavior so these values decode as Go int instances instead: // -// intType := reflect.TypeOf(int(0)) -// registryBuilder.RegisterTypeMapEntry(bsontype.Int32, intType).RegisterTypeMapEntry(bsontype.Int64, intType) +// intType := reflect.TypeOf(int(0)) +// registryBuilder.RegisterTypeMapEntry(bsontype.Int32, intType).RegisterTypeMapEntry(bsontype.Int64, intType) // // 4. Kind encoder/decoders - These can be registered using the RegisterDefaultEncoder and RegisterDefaultDecoder // methods. The registered codec will be invoked when encoding or decoding values whose reflect.Kind matches the // registered reflect.Kind as long as the value's type doesn't match a registered type or hook encoder/decoder first. // These methods should be used to change the behavior for all values for a specific kind. // -// Registry Lookup Procedure +// # Registry Lookup Procedure // // When looking up an encoder in a Registry, the precedence rules are as follows: // @@ -79,7 +79,7 @@ // rules apply for decoders, with the exception that an error of type ErrNoDecoder will be returned if no decoder is // found. // -// DefaultValueEncoders and DefaultValueDecoders +// # DefaultValueEncoders and DefaultValueDecoders // // The DefaultValueEncoders and DefaultValueDecoders types provide a full set of ValueEncoders and // ValueDecoders for handling a wide range of Go types, including all of the types within the diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go index f6f3800d404a..80644023c249 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go @@ -254,6 +254,7 @@ func (rb *RegistryBuilder) RegisterDefaultDecoder(kind reflect.Kind, dec ValueDe // By default, BSON documents will decode into interface{} values as bson.D. To change the default type for BSON // documents, a type map entry for bsontype.EmbeddedDocument should be registered. For example, to force BSON documents // to decode to bson.Raw, use the following code: +// // rb.RegisterTypeMapEntry(bsontype.EmbeddedDocument, reflect.TypeOf(bson.Raw{})) func (rb *RegistryBuilder) RegisterTypeMapEntry(bt bsontype.Type, rt reflect.Type) *RegistryBuilder { rb.typeMap[bt] = rt diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go index 6f406c162327..62708c5c745e 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go @@ -34,21 +34,21 @@ func (stpf StructTagParserFunc) ParseStructTags(sf reflect.StructField) (StructT // // The properties are defined below: // -// OmitEmpty Only include the field if it's not set to the zero value for the type or to -// empty slices or maps. +// OmitEmpty Only include the field if it's not set to the zero value for the type or to +// empty slices or maps. // -// MinSize Marshal an integer of a type larger than 32 bits value as an int32, if that's -// feasible while preserving the numeric value. +// MinSize Marshal an integer of a type larger than 32 bits value as an int32, if that's +// feasible while preserving the numeric value. // -// Truncate When unmarshaling a BSON double, it is permitted to lose precision to fit within -// a float32. +// Truncate When unmarshaling a BSON double, it is permitted to lose precision to fit within +// a float32. // -// Inline Inline the field, which must be a struct or a map, causing all of its fields -// or keys to be processed as if they were part of the outer struct. For maps, -// keys must not conflict with the bson keys of other struct fields. +// Inline Inline the field, which must be a struct or a map, causing all of its fields +// or keys to be processed as if they were part of the outer struct. For maps, +// keys must not conflict with the bson keys of other struct fields. // -// Skip This struct field should be skipped. This is usually denoted by parsing a "-" -// for the name. +// Skip This struct field should be skipped. This is usually denoted by parsing a "-" +// for the name. // // TODO(skriptble): Add tags for undefined as nil and for null as nil. type StructTags struct { @@ -67,20 +67,20 @@ type StructTags struct { // If there is no name in the struct tag fields, the struct field name is lowercased. // The tag formats accepted are: // -// "[][,[,]]" +// "[][,[,]]" // -// `(...) bson:"[][,[,]]" (...)` +// `(...) bson:"[][,[,]]" (...)` // // An example: // -// type T struct { -// A bool -// B int "myb" -// C string "myc,omitempty" -// D string `bson:",omitempty" json:"jsonkey"` -// E int64 ",minsize" -// F int64 "myf,omitempty,minsize" -// } +// type T struct { +// A bool +// B int "myb" +// C string "myc,omitempty" +// D string `bson:",omitempty" json:"jsonkey"` +// E int64 ",minsize" +// F int64 "myf,omitempty,minsize" +// } // // A struct tag either consisting entirely of '-' or with a bson key with a // value consisting entirely of '-' will return a StructTags with Skip true and diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/doc.go b/api/vendor/go.mongodb.org/mongo-driver/bson/doc.go index 5e3825a23124..0134006d8eaf 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/doc.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/doc.go @@ -9,21 +9,22 @@ // The BSON library handles marshalling and unmarshalling of values through a configurable codec system. For a description // of the codec system and examples of registering custom codecs, see the bsoncodec package. // -// Raw BSON +// # Raw BSON // // The Raw family of types is used to validate and retrieve elements from a slice of bytes. This // type is most useful when you want do lookups on BSON bytes without unmarshaling it into another // type. // // Example: -// var raw bson.Raw = ... // bytes from somewhere -// err := raw.Validate() -// if err != nil { return err } -// val := raw.Lookup("foo") -// i32, ok := val.Int32OK() -// // do something with i32... // -// Native Go Types +// var raw bson.Raw = ... // bytes from somewhere +// err := raw.Validate() +// if err != nil { return err } +// val := raw.Lookup("foo") +// i32, ok := val.Int32OK() +// // do something with i32... +// +// # Native Go Types // // The D and M types defined in this package can be used to build representations of BSON using native Go types. D is a // slice and M is a map. For more information about the use cases for these types, see the documentation on the type @@ -32,63 +33,64 @@ // Note that a D should not be constructed with duplicate key names, as that can cause undefined server behavior. // // Example: -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} // // When decoding BSON to a D or M, the following type mappings apply when unmarshalling: // -// 1. BSON int32 unmarshals to an int32. -// 2. BSON int64 unmarshals to an int64. -// 3. BSON double unmarshals to a float64. -// 4. BSON string unmarshals to a string. -// 5. BSON boolean unmarshals to a bool. -// 6. BSON embedded document unmarshals to the parent type (i.e. D for a D, M for an M). -// 7. BSON array unmarshals to a bson.A. -// 8. BSON ObjectId unmarshals to a primitive.ObjectID. -// 9. BSON datetime unmarshals to a primitive.DateTime. -// 10. BSON binary unmarshals to a primitive.Binary. -// 11. BSON regular expression unmarshals to a primitive.Regex. -// 12. BSON JavaScript unmarshals to a primitive.JavaScript. -// 13. BSON code with scope unmarshals to a primitive.CodeWithScope. -// 14. BSON timestamp unmarshals to an primitive.Timestamp. -// 15. BSON 128-bit decimal unmarshals to an primitive.Decimal128. -// 16. BSON min key unmarshals to an primitive.MinKey. -// 17. BSON max key unmarshals to an primitive.MaxKey. -// 18. BSON undefined unmarshals to a primitive.Undefined. -// 19. BSON null unmarshals to nil. -// 20. BSON DBPointer unmarshals to a primitive.DBPointer. -// 21. BSON symbol unmarshals to a primitive.Symbol. +// 1. BSON int32 unmarshals to an int32. +// 2. BSON int64 unmarshals to an int64. +// 3. BSON double unmarshals to a float64. +// 4. BSON string unmarshals to a string. +// 5. BSON boolean unmarshals to a bool. +// 6. BSON embedded document unmarshals to the parent type (i.e. D for a D, M for an M). +// 7. BSON array unmarshals to a bson.A. +// 8. BSON ObjectId unmarshals to a primitive.ObjectID. +// 9. BSON datetime unmarshals to a primitive.DateTime. +// 10. BSON binary unmarshals to a primitive.Binary. +// 11. BSON regular expression unmarshals to a primitive.Regex. +// 12. BSON JavaScript unmarshals to a primitive.JavaScript. +// 13. BSON code with scope unmarshals to a primitive.CodeWithScope. +// 14. BSON timestamp unmarshals to an primitive.Timestamp. +// 15. BSON 128-bit decimal unmarshals to an primitive.Decimal128. +// 16. BSON min key unmarshals to an primitive.MinKey. +// 17. BSON max key unmarshals to an primitive.MaxKey. +// 18. BSON undefined unmarshals to a primitive.Undefined. +// 19. BSON null unmarshals to nil. +// 20. BSON DBPointer unmarshals to a primitive.DBPointer. +// 21. BSON symbol unmarshals to a primitive.Symbol. // // The above mappings also apply when marshalling a D or M to BSON. Some other useful marshalling mappings are: // -// 1. time.Time marshals to a BSON datetime. -// 2. int8, int16, and int32 marshal to a BSON int32. -// 3. int marshals to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, inclusive, and a BSON int64 -// otherwise. -// 4. int64 marshals to BSON int64. -// 5. uint8 and uint16 marshal to a BSON int32. -// 6. uint, uint32, and uint64 marshal to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, -// inclusive, and BSON int64 otherwise. -// 7. BSON null and undefined values will unmarshal into the zero value of a field (e.g. unmarshalling a BSON null or -// undefined value into a string will yield the empty string.). +// 1. time.Time marshals to a BSON datetime. +// 2. int8, int16, and int32 marshal to a BSON int32. +// 3. int marshals to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, inclusive, and a BSON int64 +// otherwise. +// 4. int64 marshals to BSON int64. +// 5. uint8 and uint16 marshal to a BSON int32. +// 6. uint, uint32, and uint64 marshal to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, +// inclusive, and BSON int64 otherwise. +// 7. BSON null and undefined values will unmarshal into the zero value of a field (e.g. unmarshalling a BSON null or +// undefined value into a string will yield the empty string.). // -// Structs +// # Structs // // Structs can be marshalled/unmarshalled to/from BSON or Extended JSON. When transforming structs to/from BSON or Extended // JSON, the following rules apply: // -// 1. Only exported fields in structs will be marshalled or unmarshalled. +// 1. Only exported fields in structs will be marshalled or unmarshalled. // -// 2. When marshalling a struct, each field will be lowercased to generate the key for the corresponding BSON element. +// 2. When marshalling a struct, each field will be lowercased to generate the key for the corresponding BSON element. // For example, a struct field named "Foo" will generate key "foo". This can be overridden via a struct tag (e.g. // `bson:"fooField"` to generate key "fooField" instead). // -// 3. An embedded struct field is marshalled as a subdocument. The key will be the lowercased name of the field's type. +// 3. An embedded struct field is marshalled as a subdocument. The key will be the lowercased name of the field's type. // -// 4. A pointer field is marshalled as the underlying type if the pointer is non-nil. If the pointer is nil, it is +// 4. A pointer field is marshalled as the underlying type if the pointer is non-nil. If the pointer is nil, it is // marshalled as a BSON null value. // -// 5. When unmarshalling, a field of type interface{} will follow the D/M type mappings listed above. BSON documents +// 5. When unmarshalling, a field of type interface{} will follow the D/M type mappings listed above. BSON documents // unmarshalled into an interface{} field will be unmarshalled as a D. // // The encoding of each struct field can be customized by the "bson" struct tag. @@ -98,13 +100,14 @@ // are not honored, but that can be enabled by creating a StructCodec with JSONFallbackStructTagParser, like below: // // Example: -// structcodec, _ := bsoncodec.NewStructCodec(bsoncodec.JSONFallbackStructTagParser) +// +// structcodec, _ := bsoncodec.NewStructCodec(bsoncodec.JSONFallbackStructTagParser) // // The bson tag gives the name of the field, possibly followed by a comma-separated list of options. // The name may be empty in order to specify options without overriding the default field name. The following options can be used // to configure behavior: // -// 1. omitempty: If the omitempty struct tag is specified on a field, the field will not be marshalled if it is set to +// 1. omitempty: If the omitempty struct tag is specified on a field, the field will not be marshalled if it is set to // the zero value. Fields with language primitive types such as integers, booleans, and strings are considered empty if // their value is equal to the zero value for the type (i.e. 0 for integers, false for booleans, and "" for strings). // Slices, maps, and arrays are considered empty if they are of length zero. Interfaces and pointers are considered @@ -113,16 +116,16 @@ // never considered empty and will be marshalled as embedded documents. // NOTE: It is recommended that this tag be used for all slice and map fields. // -// 2. minsize: If the minsize struct tag is specified on a field of type int64, uint, uint32, or uint64 and the value of +// 2. minsize: If the minsize struct tag is specified on a field of type int64, uint, uint32, or uint64 and the value of // the field can fit in a signed int32, the field will be serialized as a BSON int32 rather than a BSON int64. For other // types, this tag is ignored. // -// 3. truncate: If the truncate struct tag is specified on a field with a non-float numeric type, BSON doubles unmarshalled +// 3. truncate: If the truncate struct tag is specified on a field with a non-float numeric type, BSON doubles unmarshalled // into that field will be truncated at the decimal point. For example, if 3.14 is unmarshalled into a field of type int, // it will be unmarshalled as 3. If this tag is not specified, the decoder will throw an error if the value cannot be // decoded without losing precision. For float64 or non-numeric types, this tag is ignored. // -// 4. inline: If the inline struct tag is specified for a struct or map field, the field will be "flattened" when +// 4. inline: If the inline struct tag is specified for a struct or map field, the field will be "flattened" when // marshalling and "un-flattened" when unmarshalling. This means that all of the fields in that struct/map will be // pulled up one level and will become top-level fields rather than being fields in a nested document. For example, if a // map field named "Map" with value map[string]interface{}{"foo": "bar"} is inlined, the resulting document will be @@ -132,7 +135,7 @@ // This tag can be used with fields that are pointers to structs. If an inlined pointer field is nil, it will not be // marshalled. For fields that are not maps or structs, this tag is ignored. // -// Marshalling and Unmarshalling +// # Marshalling and Unmarshalling // // Manually marshalling and unmarshalling can be done with the Marshal and Unmarshal family of functions. package bson diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go b/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go index ffe4eed07ae4..ba7c9112e9b2 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go @@ -191,10 +191,9 @@ func (d Decimal128) IsNaN() bool { // IsInf returns: // -// +1 d == Infinity -// 0 other case -// -1 d == -Infinity -// +// +1 d == Infinity +// 0 other case +// -1 d == -Infinity func (d Decimal128) IsInf() int { if d.h>>58&(1<<5-1) != 0x1E { return 0 diff --git a/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go b/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go index b3cba1bf9dfc..c72ccc1c4d49 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go +++ b/api/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go @@ -182,7 +182,7 @@ type MaxKey struct{} // // Example usage: // -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} type D []E // Map creates a map from the elements of the D. @@ -206,12 +206,12 @@ type E struct { // // Example usage: // -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} type M map[string]interface{} // An A is an ordered representation of a BSON array. // // Example usage: // -// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} +// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} type A []interface{} diff --git a/api/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go b/api/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go index 6c858a010992..e35bd0cd9ad3 100644 --- a/api/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go +++ b/api/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go @@ -96,8 +96,8 @@ func (ds *DocumentSequence) Empty() bool { } } -//ResetIterator resets the iteration point for the Next method to the beginning of the document -//sequence. +// ResetIterator resets the iteration point for the Next method to the beginning of the document +// sequence. func (ds *DocumentSequence) ResetIterator() { if ds == nil { return diff --git a/api/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/api/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 27c41b6f0a13..040db637fc0c 100644 --- a/api/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/api/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -1521,11 +1521,11 @@ func (m *mmapper) Munmap(data []byte) (err error) { } func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { - return mapper.Mmap(fd, offset, length, prot, flags) + return mapper.Mmap(fd, offset, length, prot, flags) } func Munmap(b []byte) (err error) { - return mapper.Munmap(b) + return mapper.Munmap(b) } func Read(fd int, p []byte) (n int, err error) { diff --git a/api/vendor/google.golang.org/appengine/internal/api.go b/api/vendor/google.golang.org/appengine/internal/api.go index 721053c20a1b..dd63ad6bc044 100644 --- a/api/vendor/google.golang.org/appengine/internal/api.go +++ b/api/vendor/google.golang.org/appengine/internal/api.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build !appengine // +build !appengine package internal diff --git a/api/vendor/google.golang.org/appengine/internal/api_classic.go b/api/vendor/google.golang.org/appengine/internal/api_classic.go index f0f40b2e35c2..12aa4e11ffdc 100644 --- a/api/vendor/google.golang.org/appengine/internal/api_classic.go +++ b/api/vendor/google.golang.org/appengine/internal/api_classic.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build appengine // +build appengine package internal diff --git a/api/vendor/google.golang.org/appengine/internal/identity_classic.go b/api/vendor/google.golang.org/appengine/internal/identity_classic.go index 4e979f45e34d..77fb7cce528e 100644 --- a/api/vendor/google.golang.org/appengine/internal/identity_classic.go +++ b/api/vendor/google.golang.org/appengine/internal/identity_classic.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build appengine // +build appengine package internal diff --git a/api/vendor/google.golang.org/appengine/internal/identity_flex.go b/api/vendor/google.golang.org/appengine/internal/identity_flex.go index d5e2e7b5e3f8..4201b6b585a6 100644 --- a/api/vendor/google.golang.org/appengine/internal/identity_flex.go +++ b/api/vendor/google.golang.org/appengine/internal/identity_flex.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build appenginevm // +build appenginevm package internal diff --git a/api/vendor/google.golang.org/appengine/internal/identity_vm.go b/api/vendor/google.golang.org/appengine/internal/identity_vm.go index 5d8067263556..8c248a8254ee 100644 --- a/api/vendor/google.golang.org/appengine/internal/identity_vm.go +++ b/api/vendor/google.golang.org/appengine/internal/identity_vm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build !appengine // +build !appengine package internal diff --git a/api/vendor/google.golang.org/appengine/internal/main.go b/api/vendor/google.golang.org/appengine/internal/main.go index 1e765312fd18..afd0ae84fdfb 100644 --- a/api/vendor/google.golang.org/appengine/internal/main.go +++ b/api/vendor/google.golang.org/appengine/internal/main.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build appengine // +build appengine package internal diff --git a/api/vendor/google.golang.org/appengine/internal/main_vm.go b/api/vendor/google.golang.org/appengine/internal/main_vm.go index ddb79a333879..4580b89648b1 100644 --- a/api/vendor/google.golang.org/appengine/internal/main_vm.go +++ b/api/vendor/google.golang.org/appengine/internal/main_vm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by the Apache 2.0 // license that can be found in the LICENSE file. +//go:build !appengine // +build !appengine package internal diff --git a/api/vendor/gopkg.in/inf.v0/dec.go b/api/vendor/gopkg.in/inf.v0/dec.go index 26548b63cef4..124cce1443bb 100644 --- a/api/vendor/gopkg.in/inf.v0/dec.go +++ b/api/vendor/gopkg.in/inf.v0/dec.go @@ -9,17 +9,16 @@ // This package is currently in experimental stage and the API may change. // // This package does NOT support: -// - rounding to specific precisions (as opposed to specific decimal positions) -// - the notion of context (each rounding must be explicit) -// - NaN and Inf values, and distinguishing between positive and negative zero -// - conversions to and from float32/64 types +// - rounding to specific precisions (as opposed to specific decimal positions) +// - the notion of context (each rounding must be explicit) +// - NaN and Inf values, and distinguishing between positive and negative zero +// - conversions to and from float32/64 types // // Features considered for possible addition: -// + formatting options -// + Exp method -// + combined operations such as AddRound/MulAdd etc -// + exchanging data in decimal32/64/128 formats -// +// - formatting options +// - Exp method +// - combined operations such as AddRound/MulAdd etc +// - exchanging data in decimal32/64/128 formats package inf // import "gopkg.in/inf.v0" // TODO: @@ -43,19 +42,19 @@ import ( // // The mathematical value of a Dec equals: // -// unscaled * 10**(-scale) +// unscaled * 10**(-scale) // // Note that different Dec representations may have equal mathematical values. // -// unscaled scale String() -// ------------------------- -// 0 0 "0" -// 0 2 "0.00" -// 0 -2 "0" -// 1 0 "1" -// 100 2 "1.00" -// 10 0 "10" -// 1 -1 "10" +// unscaled scale String() +// ------------------------- +// 0 0 "0" +// 0 2 "0.00" +// 0 -2 "0" +// 1 0 "1" +// 100 2 "1.00" +// 10 0 "10" +// 1 -1 "10" // // The zero value for a Dec represents the value 0 with scale 0. // @@ -79,7 +78,6 @@ import ( // QuoRound should be used with a Scale and a Rounder. // QuoExact or QuoRound with RoundExact can be used in the special cases when it // is known that the result is always a finite decimal. -// type Dec struct { unscaled big.Int scale Scale @@ -182,7 +180,6 @@ func (z *Dec) Set(x *Dec) *Dec { // -1 if x < 0 // 0 if x == 0 // +1 if x > 0 -// func (x *Dec) Sign() int { return x.UnscaledBig().Sign() } @@ -196,10 +193,9 @@ func (z *Dec) Neg(x *Dec) *Dec { // Cmp compares x and y and returns: // -// -1 if x < y -// 0 if x == y -// +1 if x > y -// +// -1 if x < y +// 0 if x == y +// +1 if x > y func (x *Dec) Cmp(y *Dec) int { xx, yy := upscale(x, y) return xx.UnscaledBig().Cmp(yy.UnscaledBig()) @@ -252,7 +248,6 @@ func (z *Dec) Round(x *Dec, s Scale, r Rounder) *Dec { // // There is no corresponding Div method; the equivalent can be achieved through // the choice of Rounder used. -// func (z *Dec) QuoRound(x, y *Dec, s Scale, r Rounder) *Dec { return z.quo(x, y, sclr{s}, r) } @@ -290,10 +285,9 @@ func (z *Dec) QuoExact(x, y *Dec) *Dec { // The remainder is normalized to the range -1 < r < 1 to simplify rounding; // that is, the results satisfy the following equation: // -// x / y = z + (remNum/remDen) * 10**(-z.Scale()) +// x / y = z + (remNum/remDen) * 10**(-z.Scale()) // // See Rounder for more details about rounding. -// func (z *Dec) quoRem(x, y *Dec, s Scale, useRem bool, remNum, remDen *big.Int) (*Dec, *big.Int, *big.Int) { // difference (required adjustment) compared to "canonical" result scale diff --git a/api/vendor/gopkg.in/inf.v0/rounder.go b/api/vendor/gopkg.in/inf.v0/rounder.go index 3a97ef529b97..866180bf4c6e 100644 --- a/api/vendor/gopkg.in/inf.v0/rounder.go +++ b/api/vendor/gopkg.in/inf.v0/rounder.go @@ -9,7 +9,6 @@ import ( // Dec.Quo(). // // See the Example for results of using each Rounder with some sample values. -// type Rounder rounder // See http://speleotrove.com/decimal/damodel.html#refround for more detailed diff --git a/api/vendor/gopkg.in/tomb.v1/tomb.go b/api/vendor/gopkg.in/tomb.v1/tomb.go index 9aec56d821db..35080f86d28d 100644 --- a/api/vendor/gopkg.in/tomb.v1/tomb.go +++ b/api/vendor/gopkg.in/tomb.v1/tomb.go @@ -1,10 +1,10 @@ // Copyright (c) 2011 - Gustavo Niemeyer -// +// // All rights reserved. -// +// // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: -// +// // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, @@ -13,7 +13,7 @@ // * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. -// +// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -51,13 +51,12 @@ // // For background and a detailed example, see the following blog post: // -// http://blog.labix.org/2011/10/09/death-of-goroutines-under-control +// http://blog.labix.org/2011/10/09/death-of-goroutines-under-control // // For a more complex code snippet demonstrating the use of multiple // goroutines with a single Tomb, see: // -// http://play.golang.org/p/Xh7qWsDPZP -// +// http://play.golang.org/p/Xh7qWsDPZP package tomb import ( @@ -79,7 +78,7 @@ type Tomb struct { var ( ErrStillAlive = errors.New("tomb: still alive") - ErrDying = errors.New("tomb: dying") + ErrDying = errors.New("tomb: dying") ) func (t *Tomb) init() { diff --git a/api/vendor/gopkg.in/yaml.v2/apic.go b/api/vendor/gopkg.in/yaml.v2/apic.go index acf71402cf31..fb2821e1e667 100644 --- a/api/vendor/gopkg.in/yaml.v2/apic.go +++ b/api/vendor/gopkg.in/yaml.v2/apic.go @@ -143,7 +143,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -//// Set the indentation increment. +// // Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 diff --git a/api/vendor/gopkg.in/yaml.v2/emitterc.go b/api/vendor/gopkg.in/yaml.v2/emitterc.go index a1c2cc52627f..638a268c79bf 100644 --- a/api/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/api/vendor/gopkg.in/yaml.v2/emitterc.go @@ -130,10 +130,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true diff --git a/api/vendor/gopkg.in/yaml.v2/parserc.go b/api/vendor/gopkg.in/yaml.v2/parserc.go index 81d05dfe573f..2883e5c58fab 100644 --- a/api/vendor/gopkg.in/yaml.v2/parserc.go +++ b/api/vendor/gopkg.in/yaml.v2/parserc.go @@ -170,7 +170,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -192,9 +193,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -277,8 +281,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -299,9 +303,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -332,30 +337,41 @@ func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -574,8 +590,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -627,7 +643,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -664,14 +681,14 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -723,13 +740,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -757,16 +772,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -825,11 +842,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -849,8 +865,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -873,8 +889,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -891,16 +907,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -965,8 +982,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/api/vendor/gopkg.in/yaml.v2/readerc.go b/api/vendor/gopkg.in/yaml.v2/readerc.go index 7c1f5fac3dbd..b0c436c4a84d 100644 --- a/api/vendor/gopkg.in/yaml.v2/readerc.go +++ b/api/vendor/gopkg.in/yaml.v2/readerc.go @@ -95,7 +95,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/api/vendor/gopkg.in/yaml.v2/resolve.go b/api/vendor/gopkg.in/yaml.v2/resolve.go index 4120e0c9160a..e29c364b3399 100644 --- a/api/vendor/gopkg.in/yaml.v2/resolve.go +++ b/api/vendor/gopkg.in/yaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/api/vendor/gopkg.in/yaml.v2/scannerc.go b/api/vendor/gopkg.in/yaml.v2/scannerc.go index 0b9bb6030a0f..d634dca4b04a 100644 --- a/api/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/api/vendor/gopkg.in/yaml.v2/scannerc.go @@ -1500,11 +1500,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1601,11 +1601,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1640,8 +1640,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1679,10 +1680,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1716,9 +1718,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte diff --git a/api/vendor/gopkg.in/yaml.v2/sorter.go b/api/vendor/gopkg.in/yaml.v2/sorter.go index 4c45e660a8f2..2edd734055fb 100644 --- a/api/vendor/gopkg.in/yaml.v2/sorter.go +++ b/api/vendor/gopkg.in/yaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/api/vendor/gopkg.in/yaml.v2/yaml.go b/api/vendor/gopkg.in/yaml.v2/yaml.go index 30813884c067..03756f6bbbc8 100644 --- a/api/vendor/gopkg.in/yaml.v2/yaml.go +++ b/api/vendor/gopkg.in/yaml.v2/yaml.go @@ -2,8 +2,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -67,16 +66,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -166,36 +164,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/api/vendor/gopkg.in/yaml.v2/yamlh.go b/api/vendor/gopkg.in/yaml.v2/yamlh.go index f6a9c8e34b1e..640f9d95de93 100644 --- a/api/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/api/vendor/gopkg.in/yaml.v2/yamlh.go @@ -408,7 +408,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -604,13 +606,14 @@ type yaml_parser_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/api/vendor/gopkg.in/yaml.v3/apic.go b/api/vendor/gopkg.in/yaml.v3/apic.go index ae7d049f182a..05fd305da165 100644 --- a/api/vendor/gopkg.in/yaml.v3/apic.go +++ b/api/vendor/gopkg.in/yaml.v3/apic.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/api/vendor/gopkg.in/yaml.v3/emitterc.go b/api/vendor/gopkg.in/yaml.v3/emitterc.go index 0f47c9ca8add..dde20e5079dd 100644 --- a/api/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/api/vendor/gopkg.in/yaml.v3/emitterc.go @@ -162,10 +162,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true @@ -241,7 +240,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) + emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) } } return true diff --git a/api/vendor/gopkg.in/yaml.v3/parserc.go b/api/vendor/gopkg.in/yaml.v3/parserc.go index 268558a0d632..25fe823637ab 100644 --- a/api/vendor/gopkg.in/yaml.v3/parserc.go +++ b/api/vendor/gopkg.in/yaml.v3/parserc.go @@ -227,7 +227,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -249,9 +250,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -356,8 +360,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -379,9 +383,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -428,30 +433,41 @@ func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -682,8 +698,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -740,7 +756,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -805,14 +822,14 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -881,13 +898,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -915,16 +930,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -987,11 +1004,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1011,8 +1027,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1035,8 +1051,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1053,16 +1069,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -1128,8 +1145,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/api/vendor/gopkg.in/yaml.v3/readerc.go b/api/vendor/gopkg.in/yaml.v3/readerc.go index b7de0a89c462..56af245366f2 100644 --- a/api/vendor/gopkg.in/yaml.v3/readerc.go +++ b/api/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/api/vendor/gopkg.in/yaml.v3/scannerc.go b/api/vendor/gopkg.in/yaml.v3/scannerc.go index ca0070108f4e..30b1f08920a0 100644 --- a/api/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/api/vendor/gopkg.in/yaml.v3/scannerc.go @@ -1614,11 +1614,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1719,11 +1719,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1758,8 +1758,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1797,10 +1798,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1834,9 +1836,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte @@ -2847,7 +2849,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2878,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2912,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line-parser.newlines+1 + foot_line = parser.mark.line - parser.newlines + 1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2998,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/api/vendor/gopkg.in/yaml.v3/writerc.go b/api/vendor/gopkg.in/yaml.v3/writerc.go index b8a116bf9a22..266d0b092c03 100644 --- a/api/vendor/gopkg.in/yaml.v3/writerc.go +++ b/api/vendor/gopkg.in/yaml.v3/writerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/api/vendor/gopkg.in/yaml.v3/yaml.go b/api/vendor/gopkg.in/yaml.v3/yaml.go index 8cec6da48d3e..f0bedf3d63c9 100644 --- a/api/vendor/gopkg.in/yaml.v3/yaml.go +++ b/api/vendor/gopkg.in/yaml.v3/yaml.go @@ -17,8 +17,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -75,16 +74,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -185,36 +183,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() @@ -358,22 +355,21 @@ const ( // // For example: // -// var person struct { -// Name string -// Address yaml.Node -// } -// err := yaml.Unmarshal(data, &person) -// -// Or by itself: +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) // -// var person Node -// err := yaml.Unmarshal(data, &person) +// Or by itself: // +// var person Node +// err := yaml.Unmarshal(data, &person) type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,7 +417,6 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } - // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/api/vendor/gopkg.in/yaml.v3/yamlh.go b/api/vendor/gopkg.in/yaml.v3/yamlh.go index 7c6d00770619..ddcd5513ba77 100644 --- a/api/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/api/vendor/gopkg.in/yaml.v3/yamlh.go @@ -438,7 +438,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -639,7 +641,6 @@ type yaml_parser_t struct { } type yaml_comment_t struct { - scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark @@ -659,13 +660,14 @@ type yaml_comment_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/api/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/api/vendor/gopkg.in/yaml.v3/yamlprivateh.go index e88f9c54aecb..dea1ba9610df 100644 --- a/api/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ b/api/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool { func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( - // is_break: - b[i] == '\r' || // CR (#xD) + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool { func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( - // is_space: - b[i] == ' ' || + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool { func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) diff --git a/api/vendor/gorm.io/gorm/model.go b/api/vendor/gorm.io/gorm/model.go index 3334d17cb1a4..fa705df1cd05 100644 --- a/api/vendor/gorm.io/gorm/model.go +++ b/api/vendor/gorm.io/gorm/model.go @@ -4,9 +4,10 @@ import "time" // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt // It may be embedded into your model or you may build your own model without it -// type User struct { -// gorm.Model -// } +// +// type User struct { +// gorm.Model +// } type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time diff --git a/api/vendor/gorm.io/gorm/schema/relationship.go b/api/vendor/gorm.io/gorm/schema/relationship.go index 9436f28319c4..9781d3f66337 100644 --- a/api/vendor/gorm.io/gorm/schema/relationship.go +++ b/api/vendor/gorm.io/gorm/schema/relationship.go @@ -123,16 +123,17 @@ func (schema *Schema) parseRelation(field *Field) *Relationship { } // User has many Toys, its `Polymorphic` is `Owner`, Pet has one Toy, its `Polymorphic` is `Owner` -// type User struct { -// Toys []Toy `gorm:"polymorphic:Owner;"` -// } -// type Pet struct { -// Toy Toy `gorm:"polymorphic:Owner;"` -// } -// type Toy struct { -// OwnerID int -// OwnerType string -// } +// +// type User struct { +// Toys []Toy `gorm:"polymorphic:Owner;"` +// } +// type Pet struct { +// Toy Toy `gorm:"polymorphic:Owner;"` +// } +// type Toy struct { +// OwnerID int +// OwnerType string +// } func (schema *Schema) buildPolymorphicRelation(relation *Relationship, field *Field, polymorphic string) { relation.Polymorphic = &Polymorphic{ Value: schema.Table, diff --git a/api/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go b/api/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go index 5b8514b3fab2..e38605df9237 100644 --- a/api/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go +++ b/api/vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go @@ -359,8 +359,9 @@ const ( // 4) simpleLetterEqualFold, no specials, no non-letters. // // The letters S and K are special because they map to 3 runes, not just 2: -// * S maps to s and to U+017F 'ſ' Latin small letter long s -// * k maps to K and to U+212A 'K' Kelvin sign +// - S maps to s and to U+017F 'ſ' Latin small letter long s +// - k maps to K and to U+212A 'K' Kelvin sign +// // See http://play.golang.org/p/tTxjOc0OGo // // The returned function is specialized for matching against s and diff --git a/api/vendor/sigs.k8s.io/controller-runtime/pkg/internal/flock/flock_other.go b/api/vendor/sigs.k8s.io/controller-runtime/pkg/internal/flock/flock_other.go index 069a5b3a2cb1..33c7a0799ce8 100644 --- a/api/vendor/sigs.k8s.io/controller-runtime/pkg/internal/flock/flock_other.go +++ b/api/vendor/sigs.k8s.io/controller-runtime/pkg/internal/flock/flock_other.go @@ -1,3 +1,4 @@ +//go:build !linux && !darwin && !freebsd && !openbsd && !netbsd && !dragonfly // +build !linux,!darwin,!freebsd,!openbsd,!netbsd,!dragonfly /* diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go index acf71402cf31..fb2821e1e667 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go @@ -143,7 +143,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -//// Set the indentation increment. +// // Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go index a1c2cc52627f..638a268c79bf 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go @@ -130,10 +130,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go index 81d05dfe573f..2883e5c58fab 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go @@ -170,7 +170,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -192,9 +193,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -277,8 +281,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -299,9 +303,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -332,30 +337,41 @@ func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -574,8 +590,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -627,7 +643,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -664,14 +681,14 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -723,13 +740,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -757,16 +772,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -825,11 +842,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -849,8 +865,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -873,8 +889,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -891,16 +907,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -965,8 +982,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go index 7c1f5fac3dbd..b0c436c4a84d 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go @@ -95,7 +95,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go index 4120e0c9160a..e29c364b3399 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go index 0b9bb6030a0f..d634dca4b04a 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go @@ -1500,11 +1500,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1601,11 +1601,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1640,8 +1640,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1679,10 +1680,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1716,9 +1718,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go index 4c45e660a8f2..2edd734055fb 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go index 30813884c067..03756f6bbbc8 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go @@ -2,8 +2,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -67,16 +66,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -166,36 +164,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go index f6a9c8e34b1e..640f9d95de93 100644 --- a/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go +++ b/api/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go @@ -408,7 +408,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -604,13 +606,14 @@ type yaml_parser_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/ci-images/Dockerfile.code-generation b/ci-images/Dockerfile.code-generation index 442102e84caf..4281fab7451c 100644 --- a/ci-images/Dockerfile.code-generation +++ b/ci-images/Dockerfile.code-generation @@ -21,7 +21,7 @@ COPY --from=registry.k8s.io/kustomize/kustomize:v5.7.1 /app/kustomize /usr/bin/ RUN cd / && /assisted-service/hack/setup_env.sh spectral && \ /assisted-service/hack/setup_env.sh jq && \ - go install github.com/golang/mock/mockgen@v1.5.0 && \ + go install go.uber.org/mock/mockgen@v0.6.0 && \ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 && \ go install golang.org/x/tools/cmd/goimports@v0.1.5 && \ chmod 775 -R $GOPATH diff --git a/client/vendor/github.com/asaskevich/govalidator/types.go b/client/vendor/github.com/asaskevich/govalidator/types.go index c573abb51aff..e846711696d4 100644 --- a/client/vendor/github.com/asaskevich/govalidator/types.go +++ b/client/vendor/github.com/asaskevich/govalidator/types.go @@ -177,7 +177,7 @@ type ISO3166Entry struct { Numeric string } -//ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" +// ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes" var ISO3166List = []ISO3166Entry{ {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"}, {"Albania", "Albanie (l')", "AL", "ALB", "008"}, @@ -467,7 +467,7 @@ type ISO693Entry struct { English string } -//ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json +// ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json var ISO693List = []ISO693Entry{ {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"}, {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"}, diff --git a/client/vendor/github.com/asaskevich/govalidator/validator.go b/client/vendor/github.com/asaskevich/govalidator/validator.go index 46ecfc84a4c6..110bb3cb3553 100644 --- a/client/vendor/github.com/asaskevich/govalidator/validator.go +++ b/client/vendor/github.com/asaskevich/govalidator/validator.go @@ -37,25 +37,32 @@ const rfc3339WithoutZone = "2006-01-02T15:04:05" // SetFieldsRequiredByDefault causes validation to fail when struct fields // do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). // This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter): -// type exampleStruct struct { -// Name string `` -// Email string `valid:"email"` +// +// type exampleStruct struct { +// Name string `` +// Email string `valid:"email"` +// // This, however, will only fail when Email is empty or an invalid email address: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email"` +// // Lastly, this will only fail when Email is an invalid email address but not when it's empty: -// type exampleStruct2 struct { -// Name string `valid:"-"` -// Email string `valid:"email,optional"` +// +// type exampleStruct2 struct { +// Name string `valid:"-"` +// Email string `valid:"email,optional"` func SetFieldsRequiredByDefault(value bool) { fieldsRequiredByDefault = value } // SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required. // The validation will still reject ptr fields in their zero value state. Example with this enabled: -// type exampleStruct struct { -// Name *string `valid:"required"` +// +// type exampleStruct struct { +// Name *string `valid:"required"` +// // With `Name` set to "", this will be considered invalid input and will cause a validation error. // With `Name` set to nil, this will be considered valid by validation. // By default this is disabled. @@ -154,8 +161,8 @@ func IsAlpha(str string) bool { return rxAlpha.MatchString(str) } -//IsUTFLetter checks if the string contains only unicode letter characters. -//Similar to IsAlpha but for all languages. Empty string is valid. +// IsUTFLetter checks if the string contains only unicode letter characters. +// Similar to IsAlpha but for all languages. Empty string is valid. func IsUTFLetter(str string) bool { if IsNull(str) { return true @@ -398,8 +405,8 @@ const ulidEncodedSize = 26 // IsULID checks if the string is a ULID. // // Implementation got from: -// https://github.com/oklog/ulid (Apache-2.0 License) // +// https://github.com/oklog/ulid (Apache-2.0 License) func IsULID(str string) bool { // Check if a base32 encoded ULID is the right length. if len(str) != ulidEncodedSize { @@ -596,7 +603,7 @@ func IsFilePath(str string) (bool, int) { return false, Unknown } -//IsWinFilePath checks both relative & absolute paths in Windows +// IsWinFilePath checks both relative & absolute paths in Windows func IsWinFilePath(str string) bool { if rxARWinPath.MatchString(str) { //check windows path limit see: @@ -609,7 +616,7 @@ func IsWinFilePath(str string) bool { return false } -//IsUnixFilePath checks both relative & absolute paths in Unix +// IsUnixFilePath checks both relative & absolute paths in Unix func IsUnixFilePath(str string) bool { if rxARUnixPath.MatchString(str) { return true @@ -1001,7 +1008,8 @@ func ValidateArray(array []interface{}, iterator ConditionIterator) bool { // result will be equal to `false` if there are any errors. // s is the map containing the data to be validated. // m is the validation map in the form: -// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}} +// +// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}} func ValidateMap(s map[string]interface{}, m map[string]interface{}) (bool, error) { if s == nil { return true, nil diff --git a/client/vendor/github.com/go-openapi/analysis/doc.go b/client/vendor/github.com/go-openapi/analysis/doc.go index d5294c0950b6..a00fe776f537 100644 --- a/client/vendor/github.com/go-openapi/analysis/doc.go +++ b/client/vendor/github.com/go-openapi/analysis/doc.go @@ -16,27 +16,27 @@ Package analysis provides methods to work with a Swagger specification document from package go-openapi/spec. -Analyzing a specification +# Analyzing a specification An analysed specification object (type Spec) provides methods to work with swagger definition. -Flattening or expanding a specification +# Flattening or expanding a specification Flattening a specification bundles all remote $ref in the main spec document. Depending on flattening options, additional preprocessing may take place: - full flattening: replacing all inline complex constructs by a named entry in #/definitions - expand: replace all $ref's in the document by their expanded content -Merging several specifications +# Merging several specifications Mixin several specifications merges all Swagger constructs, and warns about found conflicts. -Fixing a specification +# Fixing a specification Unmarshalling a specification with golang json unmarshalling may lead to some unwanted result on present but empty fields. -Analyzing a Swagger schema +# Analyzing a Swagger schema Swagger schemas are analyzed to determine their complexity and qualify their content. */ diff --git a/client/vendor/github.com/go-openapi/analysis/flatten.go b/client/vendor/github.com/go-openapi/analysis/flatten.go index 0576220fb3d7..ecf7e36d6151 100644 --- a/client/vendor/github.com/go-openapi/analysis/flatten.go +++ b/client/vendor/github.com/go-openapi/analysis/flatten.go @@ -62,28 +62,26 @@ func newContext() *context { // // There is a minimal and a full flattening mode. // -// // Minimally flattening a spec means: -// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left -// unscathed) -// - Importing external (http, file) references so they become internal to the document -// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers -// like "$ref": "#/definitions/myObject/allOfs/1") +// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left +// unscathed) +// - Importing external (http, file) references so they become internal to the document +// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers +// like "$ref": "#/definitions/myObject/allOfs/1") // // A minimally flattened spec thus guarantees the following properties: -// - all $refs point to a local definition (i.e. '#/definitions/...') -// - definitions are unique +// - all $refs point to a local definition (i.e. '#/definitions/...') +// - definitions are unique // // NOTE: arbitrary JSON pointers (other than $refs to top level definitions) are rewritten as definitions if they // represent a complex schema or express commonality in the spec. // Otherwise, they are simply expanded. // Self-referencing JSON pointers cannot resolve to a type and trigger an error. // -// // Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. // // Fully flattening a spec means: -// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. +// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. // // By complex, we mean every JSON object with some properties. // Arrays, when they do not define a tuple, @@ -93,22 +91,21 @@ func newContext() *context { // have been created. // // Available flattening options: -// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched -// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) -// - Verbose: croaks about name conflicts detected -// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening +// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched +// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) +// - Verbose: croaks about name conflicts detected +// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening // // NOTE: expansion removes all $ref save circular $ref, which remain in place // // TODO: additional options -// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a -// x-go-name extension -// - LiftAllOfs: -// - limit the flattening of allOf members when simple objects -// - merge allOf with validation only -// - merge allOf with extensions only -// - ... -// +// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a +// x-go-name extension +// - LiftAllOfs: +// - limit the flattening of allOf members when simple objects +// - merge allOf with validation only +// - merge allOf with extensions only +// - ... func Flatten(opts FlattenOpts) error { debugLog("FlattenOpts: %#v", opts) @@ -488,9 +485,9 @@ func stripPointersAndOAIGen(opts *FlattenOpts) error { // stripOAIGen strips the spec from unnecessary OAIGen constructs, initially created to dedupe flattened definitions. // // A dedupe is deemed unnecessary whenever: -// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) -// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to -// the first parent. +// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) +// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to +// the first parent. // // This function returns true whenever it re-inlined a complex schema, so the caller may chose to iterate // pointer and name resolution again. diff --git a/client/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go b/client/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go index 26c2a05a3101..545483bd624c 100644 --- a/client/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go +++ b/client/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go @@ -318,8 +318,8 @@ type DeepestRefResult struct { } // DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. -// - if no definition is found, returns the deepest ref. -// - pointers to external files are expanded +// - if no definition is found, returns the deepest ref. +// - pointers to external files are expanded // // NOTE: all external $ref's are assumed to be already expanded at this stage. func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { diff --git a/client/vendor/github.com/go-openapi/analysis/schema.go b/client/vendor/github.com/go-openapi/analysis/schema.go index fc055095cbb6..95f35dc756a3 100644 --- a/client/vendor/github.com/go-openapi/analysis/schema.go +++ b/client/vendor/github.com/go-openapi/analysis/schema.go @@ -247,10 +247,10 @@ func (a *AnalyzedSchema) isArrayType() bool { // isAnalyzedAsComplex determines if an analyzed schema is eligible to flattening (i.e. it is "complex"). // // Complex means the schema is any of: -// - a simple type (primitive) -// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) -// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will -// generate a definition) +// - a simple type (primitive) +// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) +// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will +// generate a definition) func (a *AnalyzedSchema) isAnalyzedAsComplex() bool { return !a.IsSimpleSchema && !a.IsArray && !a.IsMap } diff --git a/client/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go b/client/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go index 8956c30884d9..df6f715c5d50 100644 --- a/client/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go +++ b/client/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go @@ -18,13 +18,14 @@ var rxDupSlashes = regexp.MustCompile(`/{2,}`) // NormalizeURL will normalize the specified URL // This was added to replace a previous call to the no longer maintained purell library: // The call that was used looked like the following: -// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes)) +// +// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes)) // // To explain all that was included in the call above, purell.FlagsSafe was really just the following: -// - FlagLowercaseScheme -// - FlagLowercaseHost -// - FlagRemoveDefaultPort -// - FlagRemoveDuplicateSlashes (and this was mixed in with the |) +// - FlagLowercaseScheme +// - FlagLowercaseHost +// - FlagRemoveDefaultPort +// - FlagRemoveDuplicateSlashes (and this was mixed in with the |) func NormalizeURL(u *url.URL) { lowercaseScheme(u) lowercaseHost(u) diff --git a/client/vendor/github.com/go-openapi/loads/doc.go b/client/vendor/github.com/go-openapi/loads/doc.go index 3046da4cef39..f5d549039c1b 100644 --- a/client/vendor/github.com/go-openapi/loads/doc.go +++ b/client/vendor/github.com/go-openapi/loads/doc.go @@ -16,6 +16,5 @@ Package loads provides document loading methods for swagger (OAI) specifications. It is used by other go-openapi packages to load and run analysis on local or remote spec documents. - */ package loads diff --git a/client/vendor/github.com/go-openapi/loads/loaders.go b/client/vendor/github.com/go-openapi/loads/loaders.go index 44bd32b5b887..f6b50d775381 100644 --- a/client/vendor/github.com/go-openapi/loads/loaders.go +++ b/client/vendor/github.com/go-openapi/loads/loaders.go @@ -118,9 +118,8 @@ func JSONDoc(path string) (json.RawMessage, error) { // This sets the configuration at the package level. // // NOTE: -// * this updates the default loader used by github.com/go-openapi/spec -// * since this sets package level globals, you shouln't call this concurrently -// +// - this updates the default loader used by github.com/go-openapi/spec +// - since this sets package level globals, you shouln't call this concurrently func AddLoader(predicate DocMatcher, load DocLoader) { loaders = loaders.WithHead(&loader{ DocLoaderWithMatch: DocLoaderWithMatch{ diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/denco/router.go b/client/vendor/github.com/go-openapi/runtime/middleware/denco/router.go index 5d2691ec3698..1c8f3ee033b7 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/denco/router.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/denco/router.go @@ -131,7 +131,8 @@ func newDoubleArray() *doubleArray { // baseCheck contains BASE, CHECK and Extra flags. // From the top, 22bits of BASE, 2bits of Extra flags and 8bits of CHECK. // -// BASE (22bit) | Extra flags (2bit) | CHECK (8bit) +// BASE (22bit) | Extra flags (2bit) | CHECK (8bit) +// // |----------------------|--|--------| // 32 10 8 0 type baseCheck uint32 @@ -431,7 +432,7 @@ func makeRecords(srcs []Record) (statics, params []*record) { wildcardPrefix := string(SeparatorCharacter) + string(WildcardCharacter) restconfPrefix := string(PathParamCharacter) + string(ParamCharacter) for _, r := range srcs { - if strings.Contains(r.Key, paramPrefix) || strings.Contains(r.Key, wildcardPrefix) ||strings.Contains(r.Key, restconfPrefix){ + if strings.Contains(r.Key, paramPrefix) || strings.Contains(r.Key, wildcardPrefix) || strings.Contains(r.Key, restconfPrefix) { r.Key += termChar params = append(params, &record{Record: r}) } else { diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/doc.go b/client/vendor/github.com/go-openapi/runtime/middleware/doc.go index eaf90606ac32..836a98850d76 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/doc.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/doc.go @@ -12,51 +12,52 @@ // See the License for the specific language governing permissions and // limitations under the License. -/*Package middleware provides the library with helper functions for serving swagger APIs. +/* +Package middleware provides the library with helper functions for serving swagger APIs. Pseudo middleware handler - import ( - "net/http" - - "github.com/go-openapi/errors" - ) - - func newCompleteMiddleware(ctx *Context) http.Handler { - return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - // use context to lookup routes - if matched, ok := ctx.RouteInfo(r); ok { - - if matched.NeedsAuth() { - if _, err := ctx.Authorize(r, matched); err != nil { - ctx.Respond(rw, r, matched.Produces, matched, err) - return - } - } - - bound, validation := ctx.BindAndValidate(r, matched) - if validation != nil { - ctx.Respond(rw, r, matched.Produces, matched, validation) - return - } - - result, err := matched.Handler.Handle(bound) - if err != nil { - ctx.Respond(rw, r, matched.Produces, matched, err) - return - } - - ctx.Respond(rw, r, matched.Produces, matched, result) - return - } - - // Not found, check if it exists in the other methods first - if others := ctx.AllowedMethods(r); len(others) > 0 { - ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) - return - } - ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.Path)) - }) - } + import ( + "net/http" + + "github.com/go-openapi/errors" + ) + + func newCompleteMiddleware(ctx *Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // use context to lookup routes + if matched, ok := ctx.RouteInfo(r); ok { + + if matched.NeedsAuth() { + if _, err := ctx.Authorize(r, matched); err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + } + + bound, validation := ctx.BindAndValidate(r, matched) + if validation != nil { + ctx.Respond(rw, r, matched.Produces, matched, validation) + return + } + + result, err := matched.Handler.Handle(bound) + if err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + + ctx.Respond(rw, r, matched.Produces, matched, result) + return + } + + // Not found, check if it exists in the other methods first + if others := ctx.AllowedMethods(r); len(others) > 0 { + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) + return + } + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.Path)) + }) + } */ package middleware diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/go18.go b/client/vendor/github.com/go-openapi/runtime/middleware/go18.go index 75c762c09486..1bf4939c4c98 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/go18.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/go18.go @@ -1,3 +1,4 @@ +//go:build go1.8 // +build go1.8 package middleware diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go b/client/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go index 03385251e195..110afd7929e1 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go @@ -1,3 +1,4 @@ +//go:build !go1.8 // +build !go1.8 package middleware diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go b/client/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go index 4be330d6dc34..91111ac628f6 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go @@ -43,7 +43,6 @@ func (r *RapiDocOpts) EnsureDefaults() { // RapiDoc creates a middleware to serve a documentation site for a swagger spec. // This allows for altering the spec before starting the http listener. -// func RapiDoc(opts RapiDocOpts, next http.Handler) http.Handler { opts.EnsureDefaults() diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/redoc.go b/client/vendor/github.com/go-openapi/runtime/middleware/redoc.go index 019c854295be..ab88ff029530 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/redoc.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/redoc.go @@ -43,7 +43,6 @@ func (r *RedocOpts) EnsureDefaults() { // Redoc creates a middleware to serve a documentation site for a swagger spec. // This allows for altering the spec before starting the http listener. -// func Redoc(opts RedocOpts, next http.Handler) http.Handler { opts.EnsureDefaults() diff --git a/client/vendor/github.com/go-openapi/runtime/middleware/spec.go b/client/vendor/github.com/go-openapi/runtime/middleware/spec.go index f02914298060..c288a2b1780b 100644 --- a/client/vendor/github.com/go-openapi/runtime/middleware/spec.go +++ b/client/vendor/github.com/go-openapi/runtime/middleware/spec.go @@ -22,7 +22,6 @@ import ( // Spec creates a middleware to serve a swagger spec. // This allows for altering the spec before starting the http listener. // This can be useful if you want to serve the swagger spec from another path than /swagger.json -// func Spec(basePath string, b []byte, next http.Handler) http.Handler { if basePath == "" { basePath = "/" diff --git a/client/vendor/github.com/go-openapi/spec/bindata.go b/client/vendor/github.com/go-openapi/spec/bindata.go index afc83850c2e8..4363ab87a5ee 100644 --- a/client/vendor/github.com/go-openapi/spec/bindata.go +++ b/client/vendor/github.com/go-openapi/spec/bindata.go @@ -210,11 +210,13 @@ var _bindata = map[string]func() (*asset, error){ // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the // following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png +// +// data/ +// foo.txt +// img/ +// a.png +// b.png +// // then AssetDir("data") would return []string{"foo.txt", "img"}, // AssetDir("data/img") would return []string{"a.png", "b.png"}, // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and diff --git a/client/vendor/github.com/go-openapi/spec/expander.go b/client/vendor/github.com/go-openapi/spec/expander.go index d4ea889d44d5..012a4627cc45 100644 --- a/client/vendor/github.com/go-openapi/spec/expander.go +++ b/client/vendor/github.com/go-openapi/spec/expander.go @@ -27,7 +27,6 @@ import ( // all relative $ref's will be resolved from there. // // PathLoader injects a document loading method. By default, this resolves to the function provided by the SpecLoader package variable. -// type ExpandOptions struct { RelativeBase string // the path to the root document to expand. This is a file, not a directory SkipSchemas bool // do not expand schemas, just paths, parameters and responses diff --git a/client/vendor/github.com/go-openapi/spec/parameter.go b/client/vendor/github.com/go-openapi/spec/parameter.go index 2b2b89b67bf3..bd4f1cdb0760 100644 --- a/client/vendor/github.com/go-openapi/spec/parameter.go +++ b/client/vendor/github.com/go-openapi/spec/parameter.go @@ -84,27 +84,27 @@ type ParamProps struct { // Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). // // There are five possible parameter types. -// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part -// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, -// the path parameter is `itemId`. -// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. -// * Header - Custom headers that are expected as part of the request. -// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be -// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for -// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist -// together for the same operation. -// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or -// `multipart/form-data` are used as the content type of the request (in Swagger's definition, -// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used -// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be -// declared together with a body parameter for the same operation. Form parameters have a different format based on -// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). -// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. -// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple -// parameters that are being transferred. -// * `multipart/form-data` - each parameter takes a section in the payload with an internal header. -// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is -// `submit-name`. This type of form parameters is more commonly used for file transfers. +// - Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part +// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, +// the path parameter is `itemId`. +// - Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +// - Header - Custom headers that are expected as part of the request. +// - Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be +// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for +// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist +// together for the same operation. +// - Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or +// `multipart/form-data` are used as the content type of the request (in Swagger's definition, +// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used +// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be +// declared together with a body parameter for the same operation. Form parameters have a different format based on +// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). +// - `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. +// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple +// parameters that are being transferred. +// - `multipart/form-data` - each parameter takes a section in the payload with an internal header. +// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is +// `submit-name`. This type of form parameters is more commonly used for file transfers. // // For more information: http://goo.gl/8us55a#parameterObject type Parameter struct { diff --git a/client/vendor/github.com/go-openapi/strfmt/ulid.go b/client/vendor/github.com/go-openapi/strfmt/ulid.go index 4bd2ccd8f66d..6afaa2dc05cf 100644 --- a/client/vendor/github.com/go-openapi/strfmt/ulid.go +++ b/client/vendor/github.com/go-openapi/strfmt/ulid.go @@ -15,9 +15,12 @@ import ( // ULID represents a ulid string format // ref: -// https://github.com/ulid/spec +// +// https://github.com/ulid/spec +// // impl: -// https://github.com/oklog/ulid +// +// https://github.com/oklog/ulid // // swagger:strfmt ulid type ULID struct { diff --git a/client/vendor/github.com/go-openapi/validate/doc.go b/client/vendor/github.com/go-openapi/validate/doc.go index f5ca9a5d580c..351032c4c521 100644 --- a/client/vendor/github.com/go-openapi/validate/doc.go +++ b/client/vendor/github.com/go-openapi/validate/doc.go @@ -19,7 +19,7 @@ as well as tools to validate data against their schema. This package follows Swagger 2.0. specification (aka OpenAPI 2.0). Reference can be found here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md. -Validating a specification +# Validating a specification Validates a spec document (from JSON or YAML) against the JSON schema for swagger, then checks a number of extra rules that can't be expressed in JSON schema. @@ -30,34 +30,36 @@ Entry points: - SpecValidator.Validate() Reported as errors: - [x] definition can't declare a property that's already defined by one of its ancestors - [x] definition's ancestor can't be a descendant of the same model - [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method - [x] each security reference should contain only unique scopes - [x] each security scope in a security definition should be unique - [x] parameters in path must be unique - [x] each path parameter must correspond to a parameter placeholder and vice versa - [x] each referenceable definition must have references - [x] each definition property listed in the required array must be defined in the properties of the model - [x] each parameter should have a unique `name` and `type` combination - [x] each operation should have only 1 parameter of type body - [x] each reference must point to a valid object - [x] every default value that is specified must validate against the schema for that property - [x] items property is required for all schemas/definitions of type `array` - [x] path parameters must be declared a required - [x] headers must not contain $ref - [x] schema and property examples provided must validate against their respective object's schema - [x] examples provided must validate their schema + + [x] definition can't declare a property that's already defined by one of its ancestors + [x] definition's ancestor can't be a descendant of the same model + [x] path uniqueness: each api path should be non-verbatim (account for path param names) unique per method + [x] each security reference should contain only unique scopes + [x] each security scope in a security definition should be unique + [x] parameters in path must be unique + [x] each path parameter must correspond to a parameter placeholder and vice versa + [x] each referenceable definition must have references + [x] each definition property listed in the required array must be defined in the properties of the model + [x] each parameter should have a unique `name` and `type` combination + [x] each operation should have only 1 parameter of type body + [x] each reference must point to a valid object + [x] every default value that is specified must validate against the schema for that property + [x] items property is required for all schemas/definitions of type `array` + [x] path parameters must be declared a required + [x] headers must not contain $ref + [x] schema and property examples provided must validate against their respective object's schema + [x] examples provided must validate their schema Reported as warnings: - [x] path parameters should not contain any of [{,},\w] - [x] empty path - [x] unused definitions - [x] unsupported validation of examples on non-JSON media types - [x] examples in response without schema - [x] readOnly properties should not be required -Validating a schema + [x] path parameters should not contain any of [{,},\w] + [x] empty path + [x] unused definitions + [x] unsupported validation of examples on non-JSON media types + [x] examples in response without schema + [x] readOnly properties should not be required + +# Validating a schema The schema validation toolkit validates data against JSON-schema-draft 04 schema. @@ -70,16 +72,16 @@ Entry points: - AgainstSchema() - ... -Known limitations +# Known limitations With the current version of this package, the following aspects of swagger are not yet supported: - [ ] errors and warnings are not reported with key/line number in spec - [ ] default values and examples on responses only support application/json producer type - [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values - [ ] rules for collectionFormat are not implemented - [ ] no validation rule for polymorphism support (discriminator) [not done here] - [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid - [ ] arbitrary large numbers are not supported: max is math.MaxFloat64 + [ ] errors and warnings are not reported with key/line number in spec + [ ] default values and examples on responses only support application/json producer type + [ ] invalid numeric constraints (such as Minimum, etc..) are not checked except for default and example values + [ ] rules for collectionFormat are not implemented + [ ] no validation rule for polymorphism support (discriminator) [not done here] + [ ] valid js ECMA regexp not supported by Go regexp engine are considered invalid + [ ] arbitrary large numbers are not supported: max is math.MaxFloat64 */ package validate diff --git a/client/vendor/github.com/go-openapi/validate/example_validator.go b/client/vendor/github.com/go-openapi/validate/example_validator.go index c8bffd78e5ae..930b47e53009 100644 --- a/client/vendor/github.com/go-openapi/validate/example_validator.go +++ b/client/vendor/github.com/go-openapi/validate/example_validator.go @@ -48,7 +48,6 @@ func (ex *exampleValidator) isVisited(path string) bool { // - schemas // - individual property // - responses -// func (ex *exampleValidator) Validate() (errs *Result) { errs = new(Result) if ex == nil || ex.SpecValidator == nil { diff --git a/client/vendor/github.com/go-openapi/validate/spec.go b/client/vendor/github.com/go-openapi/validate/spec.go index dff01f00be73..47f291e6c39d 100644 --- a/client/vendor/github.com/go-openapi/validate/spec.go +++ b/client/vendor/github.com/go-openapi/validate/spec.go @@ -32,17 +32,16 @@ import ( // // Returns an error flattening in a single standard error, all validation messages. // -// - TODO: $ref should not have siblings -// - TODO: make sure documentation reflects all checks and warnings -// - TODO: check on discriminators -// - TODO: explicit message on unsupported keywords (better than "forbidden property"...) -// - TODO: full list of unresolved refs -// - TODO: validate numeric constraints (issue#581): this should be handled like defaults and examples -// - TODO: option to determine if we validate for go-swagger or in a more general context -// - TODO: check on required properties to support anyOf, allOf, oneOf +// - TODO: $ref should not have siblings +// - TODO: make sure documentation reflects all checks and warnings +// - TODO: check on discriminators +// - TODO: explicit message on unsupported keywords (better than "forbidden property"...) +// - TODO: full list of unresolved refs +// - TODO: validate numeric constraints (issue#581): this should be handled like defaults and examples +// - TODO: option to determine if we validate for go-swagger or in a more general context +// - TODO: check on required properties to support anyOf, allOf, oneOf // // NOTE: SecurityScopes are maps: no need to check uniqueness -// func Spec(doc *loads.Document, formats strfmt.Registry) error { errs, _ /*warns*/ := NewSpecValidator(doc.Schema(), formats).Validate(doc) if errs.HasErrors() { diff --git a/client/vendor/github.com/go-openapi/validate/spec_messages.go b/client/vendor/github.com/go-openapi/validate/spec_messages.go index b3757adddbd3..5398679bffef 100644 --- a/client/vendor/github.com/go-openapi/validate/spec_messages.go +++ b/client/vendor/github.com/go-openapi/validate/spec_messages.go @@ -349,9 +349,10 @@ func parameterValidationTypeMismatchMsg(param, path, typ string) errors.Error { } // disabled -// func invalidResponseDefinitionAsSchemaMsg(path, method string) errors.Error { -// return errors.New(errors.CompositeErrorCode, InvalidResponseDefinitionAsSchemaError, path, method) -// } +// +// func invalidResponseDefinitionAsSchemaMsg(path, method string) errors.Error { +// return errors.New(errors.CompositeErrorCode, InvalidResponseDefinitionAsSchemaError, path, method) +// } func someParametersBrokenMsg(path, method, operationID string) errors.Error { return errors.New(errors.CompositeErrorCode, SomeParametersBrokenError, path, method, operationID) } diff --git a/client/vendor/github.com/jinzhu/inflection/inflections.go b/client/vendor/github.com/jinzhu/inflection/inflections.go index 606263bb7507..01fecd5c1c84 100644 --- a/client/vendor/github.com/jinzhu/inflection/inflections.go +++ b/client/vendor/github.com/jinzhu/inflection/inflections.go @@ -1,25 +1,25 @@ /* Package inflection pluralizes and singularizes English nouns. - inflection.Plural("person") => "people" - inflection.Plural("Person") => "People" - inflection.Plural("PERSON") => "PEOPLE" + inflection.Plural("person") => "people" + inflection.Plural("Person") => "People" + inflection.Plural("PERSON") => "PEOPLE" - inflection.Singular("people") => "person" - inflection.Singular("People") => "Person" - inflection.Singular("PEOPLE") => "PERSON" + inflection.Singular("people") => "person" + inflection.Singular("People") => "Person" + inflection.Singular("PEOPLE") => "PERSON" - inflection.Plural("FancyPerson") => "FancydPeople" - inflection.Singular("FancyPeople") => "FancydPerson" + inflection.Plural("FancyPerson") => "FancydPeople" + inflection.Singular("FancyPeople") => "FancydPerson" Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb) If you want to register more rules, follow: - inflection.AddUncountable("fish") - inflection.AddIrregular("person", "people") - inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses" - inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS" + inflection.AddUncountable("fish") + inflection.AddIrregular("person", "people") + inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses" + inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS" */ package inflection diff --git a/client/vendor/github.com/jinzhu/now/main.go b/client/vendor/github.com/jinzhu/now/main.go index e972cd8d5574..4428d438cc7b 100644 --- a/client/vendor/github.com/jinzhu/now/main.go +++ b/client/vendor/github.com/jinzhu/now/main.go @@ -2,11 +2,11 @@ // // More details README here: https://github.com/jinzhu/now // -// import "github.com/jinzhu/now" +// import "github.com/jinzhu/now" // -// now.BeginningOfMinute() // 2013-11-18 17:51:00 Mon -// now.BeginningOfDay() // 2013-11-18 00:00:00 Mon -// now.EndOfDay() // 2013-11-18 23:59:59.999999999 Mon +// now.BeginningOfMinute() // 2013-11-18 17:51:00 Mon +// now.BeginningOfDay() // 2013-11-18 00:00:00 Mon +// now.EndOfDay() // 2013-11-18 23:59:59.999999999 Mon package now import "time" diff --git a/client/vendor/github.com/jinzhu/now/now.go b/client/vendor/github.com/jinzhu/now/now.go index d1fb8ae1d76a..f25fc9146678 100644 --- a/client/vendor/github.com/jinzhu/now/now.go +++ b/client/vendor/github.com/jinzhu/now/now.go @@ -150,7 +150,7 @@ func (now *Now) parseWithFormat(str string, location *time.Location) (t time.Tim } var hasTimeRegexp = regexp.MustCompile(`(\s+|^\s*|T)\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))(\s*$|[Z+-])`) // match 15:04:05, 15:04:05.000, 15:04:05.000000 15, 2017-01-01 15:04, 2021-07-20T00:59:10Z, 2021-07-20T00:59:10+08:00, 2021-07-20T00:00:10-07:00 etc -var onlyTimeRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`) // match 15:04:05, 15, 15:04:05.000, 15:04:05.000000, etc +var onlyTimeRegexp = regexp.MustCompile(`^\s*\d{1,2}((:\d{1,2})*|((:\d{1,2}){2}\.(\d{3}|\d{6}|\d{9})))\s*$`) // match 15:04:05, 15, 15:04:05.000, 15:04:05.000000, etc // Parse parse string to time func (now *Now) Parse(strs ...string) (t time.Time, err error) { diff --git a/client/vendor/github.com/lib/pq/array.go b/client/vendor/github.com/lib/pq/array.go index 39c8f7e2e032..9957c04891d2 100644 --- a/client/vendor/github.com/lib/pq/array.go +++ b/client/vendor/github.com/lib/pq/array.go @@ -19,10 +19,11 @@ var typeSQLScanner = reflect.TypeOf((*sql.Scanner)(nil)).Elem() // slice of any dimension. // // For example: -// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401})) // -// var x []sql.NullInt64 -// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x)) +// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401})) +// +// var x []sql.NullInt64 +// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x)) // // Scanning multi-dimensional arrays is not supported. Arrays where the lower // bound is not one (such as `[0:0]={1}') are not supported. diff --git a/client/vendor/github.com/lib/pq/doc.go b/client/vendor/github.com/lib/pq/doc.go index b57184801ba9..96309ff89f9d 100644 --- a/client/vendor/github.com/lib/pq/doc.go +++ b/client/vendor/github.com/lib/pq/doc.go @@ -27,9 +27,7 @@ You can also connect to a database using a URL. For example: connStr := "postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full" db, err := sql.Open("postgres", connStr) - -Connection String Parameters - +# Connection String Parameters Similarly to libpq, when establishing a connection using pq you are expected to supply a connection string containing zero or more parameters. @@ -42,42 +40,42 @@ them in the options parameter. For compatibility with libpq, the following special connection parameters are supported: - * dbname - The name of the database to connect to - * user - The user to sign in as - * password - The user's password - * host - The host to connect to. Values that start with / are for unix - domain sockets. (default is localhost) - * port - The port to bind to. (default is 5432) - * sslmode - Whether or not to use SSL (default is require, this is not - the default for libpq) - * fallback_application_name - An application_name to fall back to if one isn't provided. - * connect_timeout - Maximum wait for connection, in seconds. Zero or - not specified means wait indefinitely. - * sslcert - Cert file location. The file must contain PEM encoded data. - * sslkey - Key file location. The file must contain PEM encoded data. - * sslrootcert - The location of the root certificate file. The file - must contain PEM encoded data. + - dbname - The name of the database to connect to + - user - The user to sign in as + - password - The user's password + - host - The host to connect to. Values that start with / are for unix + domain sockets. (default is localhost) + - port - The port to bind to. (default is 5432) + - sslmode - Whether or not to use SSL (default is require, this is not + the default for libpq) + - fallback_application_name - An application_name to fall back to if one isn't provided. + - connect_timeout - Maximum wait for connection, in seconds. Zero or + not specified means wait indefinitely. + - sslcert - Cert file location. The file must contain PEM encoded data. + - sslkey - Key file location. The file must contain PEM encoded data. + - sslrootcert - The location of the root certificate file. The file + must contain PEM encoded data. Valid values for sslmode are: - * disable - No SSL - * require - Always SSL (skip verification) - * verify-ca - Always SSL (verify that the certificate presented by the - server was signed by a trusted CA) - * verify-full - Always SSL (verify that the certification presented by - the server was signed by a trusted CA and the server host name - matches the one in the certificate) + - disable - No SSL + - require - Always SSL (skip verification) + - verify-ca - Always SSL (verify that the certificate presented by the + server was signed by a trusted CA) + - verify-full - Always SSL (verify that the certification presented by + the server was signed by a trusted CA and the server host name + matches the one in the certificate) See http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING for more information about connection string parameters. Use single quotes for values that contain whitespace: - "user=pqgotest password='with spaces'" + "user=pqgotest password='with spaces'" A backslash will escape the next character in values: - "user=space\ man password='it\'s valid'" + "user=space\ man password='it\'s valid'" Note that the connection parameter client_encoding (which sets the text encoding for the connection) may be set but must be "UTF8", @@ -98,9 +96,7 @@ provided connection parameters. The pgpass mechanism as described in http://www.postgresql.org/docs/current/static/libpq-pgpass.html is supported, but on Windows PGPASSFILE must be specified explicitly. - -Queries - +# Queries database/sql does not dictate any specific format for parameter markers in query strings, and pq uses the Postgres-native ordinal markers, @@ -125,9 +121,7 @@ For more details on RETURNING, see the Postgres documentation: For additional instructions on querying see the documentation for the database/sql package. - -Data Types - +# Data Types Parameters pass through driver.DefaultParameterConverter before they are handled by this package. When the binary_parameters connection option is enabled, @@ -135,30 +129,27 @@ by this package. When the binary_parameters connection option is enabled, This package returns the following types for values from the PostgreSQL backend: - - integer types smallint, integer, and bigint are returned as int64 - - floating-point types real and double precision are returned as float64 - - character types char, varchar, and text are returned as string - - temporal types date, time, timetz, timestamp, and timestamptz are - returned as time.Time - - the boolean type is returned as bool - - the bytea type is returned as []byte + - integer types smallint, integer, and bigint are returned as int64 + - floating-point types real and double precision are returned as float64 + - character types char, varchar, and text are returned as string + - temporal types date, time, timetz, timestamp, and timestamptz are + returned as time.Time + - the boolean type is returned as bool + - the bytea type is returned as []byte All other types are returned directly from the backend as []byte values in text format. - -Errors - +# Errors pq may return errors of type *pq.Error which can be interrogated for error details: - if err, ok := err.(*pq.Error); ok { - fmt.Println("pq error:", err.Code.Name()) - } + if err, ok := err.(*pq.Error); ok { + fmt.Println("pq error:", err.Code.Name()) + } See the pq.Error type for details. - -Bulk imports +# Bulk imports You can perform bulk imports by preparing a statement returned by pq.CopyIn (or pq.CopyInSchema) in an explicit transaction (sql.Tx). The returned statement @@ -206,9 +197,7 @@ Usage example: log.Fatal(err) } - -Notifications - +# Notifications PostgreSQL supports a simple publish/subscribe model over database connections. See http://www.postgresql.org/docs/current/static/sql-notify.html @@ -241,9 +230,7 @@ bytes by the PostgreSQL server. You can find a complete, working example of Listener usage at https://godoc.org/github.com/lib/pq/example/listen. - -Kerberos Support - +# Kerberos Support If you need support for Kerberos authentication, add the following to your main package: @@ -259,10 +246,10 @@ don't have to download unnecessary dependencies. When imported, additional connection string parameters are supported: - * krbsrvname - GSS (Kerberos) service name when constructing the - SPN (default is `postgres`). This will be combined with the host - to form the full SPN: `krbsrvname/host`. - * krbspn - GSS (Kerberos) SPN. This takes priority over - `krbsrvname` if present. + - krbsrvname - GSS (Kerberos) service name when constructing the + SPN (default is `postgres`). This will be combined with the host + to form the full SPN: `krbsrvname/host`. + - krbspn - GSS (Kerberos) SPN. This takes priority over + `krbsrvname` if present. */ package pq diff --git a/client/vendor/github.com/lib/pq/notify.go b/client/vendor/github.com/lib/pq/notify.go index 5c421fdb8b56..5e68d5364936 100644 --- a/client/vendor/github.com/lib/pq/notify.go +++ b/client/vendor/github.com/lib/pq/notify.go @@ -330,11 +330,11 @@ func (l *ListenerConn) sendSimpleQuery(q string) (err error) { // ExecSimpleQuery executes a "simple query" (i.e. one with no bindable // parameters) on the connection. The possible return values are: -// 1) "executed" is true; the query was executed to completion on the -// database server. If the query failed, err will be set to the error -// returned by the database, otherwise err will be nil. -// 2) If "executed" is false, the query could not be executed on the remote -// server. err will be non-nil. +// 1. "executed" is true; the query was executed to completion on the +// database server. If the query failed, err will be set to the error +// returned by the database, otherwise err will be nil. +// 2. If "executed" is false, the query could not be executed on the remote +// server. err will be non-nil. // // After a call to ExecSimpleQuery has returned an executed=false value, the // connection has either been closed or will be closed shortly thereafter, and @@ -541,12 +541,12 @@ func (l *Listener) NotificationChannel() <-chan *Notification { // connection can not be re-established. // // Listen will only fail in three conditions: -// 1) The channel is already open. The returned error will be -// ErrChannelAlreadyOpen. -// 2) The query was executed on the remote server, but PostgreSQL returned an -// error message in response to the query. The returned error will be a -// pq.Error containing the information the server supplied. -// 3) Close is called on the Listener before the request could be completed. +// 1. The channel is already open. The returned error will be +// ErrChannelAlreadyOpen. +// 2. The query was executed on the remote server, but PostgreSQL returned an +// error message in response to the query. The returned error will be a +// pq.Error containing the information the server supplied. +// 3. Close is called on the Listener before the request could be completed. // // The channel name is case-sensitive. func (l *Listener) Listen(channel string) error { diff --git a/client/vendor/github.com/lib/pq/scram/scram.go b/client/vendor/github.com/lib/pq/scram/scram.go index 477216b6008a..0e1ef6563283 100644 --- a/client/vendor/github.com/lib/pq/scram/scram.go +++ b/client/vendor/github.com/lib/pq/scram/scram.go @@ -25,7 +25,6 @@ // Package scram implements a SCRAM-{SHA-1,etc} client per RFC5802. // // http://tools.ietf.org/html/rfc5802 -// package scram import ( @@ -43,17 +42,16 @@ import ( // // A Client may be used within a SASL conversation with logic resembling: // -// var in []byte -// var client = scram.NewClient(sha1.New, user, pass) -// for client.Step(in) { -// out := client.Out() -// // send out to server -// in := serverOut -// } -// if client.Err() != nil { -// // auth failed -// } -// +// var in []byte +// var client = scram.NewClient(sha1.New, user, pass) +// for client.Step(in) { +// out := client.Out() +// // send out to server +// in := serverOut +// } +// if client.Err() != nil { +// // auth failed +// } type Client struct { newHash func() hash.Hash @@ -73,8 +71,7 @@ type Client struct { // // For SCRAM-SHA-256, for example, use: // -// client := scram.NewClient(sha256.New, user, pass) -// +// client := scram.NewClient(sha256.New, user, pass) func NewClient(newHash func() hash.Hash, user, pass string) *Client { c := &Client{ newHash: newHash, diff --git a/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go b/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go index ff7b27c5b203..87f7fb7a4459 100644 --- a/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go +++ b/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr.go @@ -2,8 +2,8 @@ // easyjson_nounsafe nor appengine build tag is set. See README notes // for more details. -//+build !easyjson_nounsafe -//+build !appengine +//go:build !easyjson_nounsafe && !appengine +// +build !easyjson_nounsafe,!appengine package jlexer diff --git a/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go b/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go index 864d1be67638..5c24365ccdb6 100644 --- a/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go +++ b/client/vendor/github.com/mailru/easyjson/jlexer/bytestostr_nounsafe.go @@ -1,7 +1,8 @@ // This file is included to the build if any of the buildtags below // are defined. Refer to README notes for more details. -//+build easyjson_nounsafe appengine +//go:build easyjson_nounsafe || appengine +// +build easyjson_nounsafe appengine package jlexer diff --git a/client/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/client/vendor/github.com/mitchellh/mapstructure/mapstructure.go index 1efb22ac3610..fadccc4ab8d1 100644 --- a/client/vendor/github.com/mitchellh/mapstructure/mapstructure.go +++ b/client/vendor/github.com/mitchellh/mapstructure/mapstructure.go @@ -9,84 +9,84 @@ // // The simplest function to start with is Decode. // -// Field Tags +// # Field Tags // // When decoding to a struct, mapstructure will use the field name by // default to perform the mapping. For example, if a struct has a field // "Username" then mapstructure will look for a key in the source value // of "username" (case insensitive). // -// type User struct { -// Username string -// } +// type User struct { +// Username string +// } // // You can change the behavior of mapstructure by using struct tags. // The default struct tag that mapstructure looks for is "mapstructure" // but you can customize it using DecoderConfig. // -// Renaming Fields +// # Renaming Fields // // To rename the key that mapstructure looks for, use the "mapstructure" // tag and set a value directly. For example, to change the "username" example // above to "user": // -// type User struct { -// Username string `mapstructure:"user"` -// } +// type User struct { +// Username string `mapstructure:"user"` +// } // -// Embedded Structs and Squashing +// # Embedded Structs and Squashing // // Embedded structs are treated as if they're another field with that name. // By default, the two structs below are equivalent when decoding with // mapstructure: // -// type Person struct { -// Name string -// } +// type Person struct { +// Name string +// } // -// type Friend struct { -// Person -// } +// type Friend struct { +// Person +// } // -// type Friend struct { -// Person Person -// } +// type Friend struct { +// Person Person +// } // // This would require an input that looks like below: // -// map[string]interface{}{ -// "person": map[string]interface{}{"name": "alice"}, -// } +// map[string]interface{}{ +// "person": map[string]interface{}{"name": "alice"}, +// } // // If your "person" value is NOT nested, then you can append ",squash" to // your tag value and mapstructure will treat it as if the embedded struct // were part of the struct directly. Example: // -// type Friend struct { -// Person `mapstructure:",squash"` -// } +// type Friend struct { +// Person `mapstructure:",squash"` +// } // // Now the following input would be accepted: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // When decoding from a struct to a map, the squash tag squashes the struct // fields into a single map. Using the example structs from above: // -// Friend{Person: Person{Name: "alice"}} +// Friend{Person: Person{Name: "alice"}} // // Will be decoded into a map: // -// map[string]interface{}{ -// "name": "alice", -// } +// map[string]interface{}{ +// "name": "alice", +// } // // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. // -// Remainder Values +// # Remainder Values // // If there are any unmapped keys in the source value, mapstructure by // default will silently ignore them. You can error by setting ErrorUnused @@ -98,20 +98,20 @@ // probably be a "map[string]interface{}" or "map[interface{}]interface{}". // See example below: // -// type Friend struct { -// Name string -// Other map[string]interface{} `mapstructure:",remain"` -// } +// type Friend struct { +// Name string +// Other map[string]interface{} `mapstructure:",remain"` +// } // // Given the input below, Other would be populated with the other // values that weren't used (everything but "name"): // -// map[string]interface{}{ -// "name": "bob", -// "address": "123 Maple St.", -// } +// map[string]interface{}{ +// "name": "bob", +// "address": "123 Maple St.", +// } // -// Omit Empty Values +// # Omit Empty Values // // When decoding from a struct to any other value, you may use the // ",omitempty" suffix on your tag to omit that value if it equates to @@ -122,37 +122,37 @@ // field value is zero and a numeric type, the field is empty, and it won't // be encoded into the destination type. // -// type Source struct { -// Age int `mapstructure:",omitempty"` -// } +// type Source struct { +// Age int `mapstructure:",omitempty"` +// } // -// Unexported fields +// # Unexported fields // // Since unexported (private) struct fields cannot be set outside the package // where they are defined, the decoder will simply skip them. // // For this output type definition: // -// type Exported struct { -// private string // this unexported field will be skipped -// Public string -// } +// type Exported struct { +// private string // this unexported field will be skipped +// Public string +// } // // Using this map as input: // -// map[string]interface{}{ -// "private": "I will be ignored", -// "Public": "I made it through!", -// } +// map[string]interface{}{ +// "private": "I will be ignored", +// "Public": "I made it through!", +// } // // The following struct will be decoded: // -// type Exported struct { -// private: "" // field is left with an empty string (zero value) -// Public: "I made it through!" -// } +// type Exported struct { +// private: "" // field is left with an empty string (zero value) +// Public: "I made it through!" +// } // -// Other Configuration +// # Other Configuration // // mapstructure is highly configurable. See the DecoderConfig struct // for other features and options that are supported. diff --git a/client/vendor/github.com/oklog/ulid/ulid.go b/client/vendor/github.com/oklog/ulid/ulid.go index c5d0d66fd2a4..03e62d4831da 100644 --- a/client/vendor/github.com/oklog/ulid/ulid.go +++ b/client/vendor/github.com/oklog/ulid/ulid.go @@ -376,7 +376,8 @@ func MaxTime() uint64 { return maxTime } // Now is a convenience function that returns the current // UTC time in Unix milliseconds. Equivalent to: -// Timestamp(time.Now().UTC()) +// +// Timestamp(time.Now().UTC()) func Now() uint64 { return Timestamp(time.Now().UTC()) } // Timestamp converts a time.Time to Unix milliseconds. @@ -457,7 +458,7 @@ func (id *ULID) Scan(src interface{}) error { // type can be created that calls String(). // // // stringValuer wraps a ULID as a string-based driver.Valuer. -// type stringValuer ULID +// type stringValuer ULID // // func (id stringValuer) Value() (driver.Value, error) { // return ULID(id).String(), nil diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/bson.go b/client/vendor/go.mongodb.org/mongo-driver/bson/bson.go index 95ffc1078da1..a0d818582611 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/bson.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/bson.go @@ -27,7 +27,7 @@ type Zeroer interface { // // Example usage: // -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} type D = primitive.D // E represents a BSON element for a D. It is usually used inside a D. @@ -39,12 +39,12 @@ type E = primitive.E // // Example usage: // -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} type M = primitive.M // An A is an ordered representation of a BSON array. // // Example usage: // -// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} +// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} type A = primitive.A diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go index b0ae0e23ff2e..5f903ebea6c9 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/doc.go @@ -17,7 +17,7 @@ // 2) A Registry that holds these ValueEncoders and ValueDecoders and provides methods for // retrieving them. // -// ValueEncoders and ValueDecoders +// # ValueEncoders and ValueDecoders // // The ValueEncoder interface is implemented by types that can encode a provided Go type to BSON. // The value to encode is provided as a reflect.Value and a bsonrw.ValueWriter is used within the @@ -31,7 +31,7 @@ // allow the use of a function with the correct signature as a ValueDecoder. A DecodeContext // instance is provided and serves similar functionality to the EncodeContext. // -// Registry and RegistryBuilder +// # Registry and RegistryBuilder // // A Registry is an immutable store for ValueEncoders, ValueDecoders, and a type map. See the Registry type // documentation for examples of registering various custom encoders and decoders. A Registry can be constructed using a @@ -53,15 +53,15 @@ // values decode as Go int32 and int64 instances, respectively, when decoding into a bson.D. The following code would // change the behavior so these values decode as Go int instances instead: // -// intType := reflect.TypeOf(int(0)) -// registryBuilder.RegisterTypeMapEntry(bsontype.Int32, intType).RegisterTypeMapEntry(bsontype.Int64, intType) +// intType := reflect.TypeOf(int(0)) +// registryBuilder.RegisterTypeMapEntry(bsontype.Int32, intType).RegisterTypeMapEntry(bsontype.Int64, intType) // // 4. Kind encoder/decoders - These can be registered using the RegisterDefaultEncoder and RegisterDefaultDecoder // methods. The registered codec will be invoked when encoding or decoding values whose reflect.Kind matches the // registered reflect.Kind as long as the value's type doesn't match a registered type or hook encoder/decoder first. // These methods should be used to change the behavior for all values for a specific kind. // -// Registry Lookup Procedure +// # Registry Lookup Procedure // // When looking up an encoder in a Registry, the precedence rules are as follows: // @@ -79,7 +79,7 @@ // rules apply for decoders, with the exception that an error of type ErrNoDecoder will be returned if no decoder is // found. // -// DefaultValueEncoders and DefaultValueDecoders +// # DefaultValueEncoders and DefaultValueDecoders // // The DefaultValueEncoders and DefaultValueDecoders types provide a full set of ValueEncoders and // ValueDecoders for handling a wide range of Go types, including all of the types within the diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go index f6f3800d404a..80644023c249 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go @@ -254,6 +254,7 @@ func (rb *RegistryBuilder) RegisterDefaultDecoder(kind reflect.Kind, dec ValueDe // By default, BSON documents will decode into interface{} values as bson.D. To change the default type for BSON // documents, a type map entry for bsontype.EmbeddedDocument should be registered. For example, to force BSON documents // to decode to bson.Raw, use the following code: +// // rb.RegisterTypeMapEntry(bsontype.EmbeddedDocument, reflect.TypeOf(bson.Raw{})) func (rb *RegistryBuilder) RegisterTypeMapEntry(bt bsontype.Type, rt reflect.Type) *RegistryBuilder { rb.typeMap[bt] = rt diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go index 6f406c162327..62708c5c745e 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_tag_parser.go @@ -34,21 +34,21 @@ func (stpf StructTagParserFunc) ParseStructTags(sf reflect.StructField) (StructT // // The properties are defined below: // -// OmitEmpty Only include the field if it's not set to the zero value for the type or to -// empty slices or maps. +// OmitEmpty Only include the field if it's not set to the zero value for the type or to +// empty slices or maps. // -// MinSize Marshal an integer of a type larger than 32 bits value as an int32, if that's -// feasible while preserving the numeric value. +// MinSize Marshal an integer of a type larger than 32 bits value as an int32, if that's +// feasible while preserving the numeric value. // -// Truncate When unmarshaling a BSON double, it is permitted to lose precision to fit within -// a float32. +// Truncate When unmarshaling a BSON double, it is permitted to lose precision to fit within +// a float32. // -// Inline Inline the field, which must be a struct or a map, causing all of its fields -// or keys to be processed as if they were part of the outer struct. For maps, -// keys must not conflict with the bson keys of other struct fields. +// Inline Inline the field, which must be a struct or a map, causing all of its fields +// or keys to be processed as if they were part of the outer struct. For maps, +// keys must not conflict with the bson keys of other struct fields. // -// Skip This struct field should be skipped. This is usually denoted by parsing a "-" -// for the name. +// Skip This struct field should be skipped. This is usually denoted by parsing a "-" +// for the name. // // TODO(skriptble): Add tags for undefined as nil and for null as nil. type StructTags struct { @@ -67,20 +67,20 @@ type StructTags struct { // If there is no name in the struct tag fields, the struct field name is lowercased. // The tag formats accepted are: // -// "[][,[,]]" +// "[][,[,]]" // -// `(...) bson:"[][,[,]]" (...)` +// `(...) bson:"[][,[,]]" (...)` // // An example: // -// type T struct { -// A bool -// B int "myb" -// C string "myc,omitempty" -// D string `bson:",omitempty" json:"jsonkey"` -// E int64 ",minsize" -// F int64 "myf,omitempty,minsize" -// } +// type T struct { +// A bool +// B int "myb" +// C string "myc,omitempty" +// D string `bson:",omitempty" json:"jsonkey"` +// E int64 ",minsize" +// F int64 "myf,omitempty,minsize" +// } // // A struct tag either consisting entirely of '-' or with a bson key with a // value consisting entirely of '-' will return a StructTags with Skip true and diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/doc.go b/client/vendor/go.mongodb.org/mongo-driver/bson/doc.go index 5e3825a23124..0134006d8eaf 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/doc.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/doc.go @@ -9,21 +9,22 @@ // The BSON library handles marshalling and unmarshalling of values through a configurable codec system. For a description // of the codec system and examples of registering custom codecs, see the bsoncodec package. // -// Raw BSON +// # Raw BSON // // The Raw family of types is used to validate and retrieve elements from a slice of bytes. This // type is most useful when you want do lookups on BSON bytes without unmarshaling it into another // type. // // Example: -// var raw bson.Raw = ... // bytes from somewhere -// err := raw.Validate() -// if err != nil { return err } -// val := raw.Lookup("foo") -// i32, ok := val.Int32OK() -// // do something with i32... // -// Native Go Types +// var raw bson.Raw = ... // bytes from somewhere +// err := raw.Validate() +// if err != nil { return err } +// val := raw.Lookup("foo") +// i32, ok := val.Int32OK() +// // do something with i32... +// +// # Native Go Types // // The D and M types defined in this package can be used to build representations of BSON using native Go types. D is a // slice and M is a map. For more information about the use cases for these types, see the documentation on the type @@ -32,63 +33,64 @@ // Note that a D should not be constructed with duplicate key names, as that can cause undefined server behavior. // // Example: -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} // // When decoding BSON to a D or M, the following type mappings apply when unmarshalling: // -// 1. BSON int32 unmarshals to an int32. -// 2. BSON int64 unmarshals to an int64. -// 3. BSON double unmarshals to a float64. -// 4. BSON string unmarshals to a string. -// 5. BSON boolean unmarshals to a bool. -// 6. BSON embedded document unmarshals to the parent type (i.e. D for a D, M for an M). -// 7. BSON array unmarshals to a bson.A. -// 8. BSON ObjectId unmarshals to a primitive.ObjectID. -// 9. BSON datetime unmarshals to a primitive.DateTime. -// 10. BSON binary unmarshals to a primitive.Binary. -// 11. BSON regular expression unmarshals to a primitive.Regex. -// 12. BSON JavaScript unmarshals to a primitive.JavaScript. -// 13. BSON code with scope unmarshals to a primitive.CodeWithScope. -// 14. BSON timestamp unmarshals to an primitive.Timestamp. -// 15. BSON 128-bit decimal unmarshals to an primitive.Decimal128. -// 16. BSON min key unmarshals to an primitive.MinKey. -// 17. BSON max key unmarshals to an primitive.MaxKey. -// 18. BSON undefined unmarshals to a primitive.Undefined. -// 19. BSON null unmarshals to nil. -// 20. BSON DBPointer unmarshals to a primitive.DBPointer. -// 21. BSON symbol unmarshals to a primitive.Symbol. +// 1. BSON int32 unmarshals to an int32. +// 2. BSON int64 unmarshals to an int64. +// 3. BSON double unmarshals to a float64. +// 4. BSON string unmarshals to a string. +// 5. BSON boolean unmarshals to a bool. +// 6. BSON embedded document unmarshals to the parent type (i.e. D for a D, M for an M). +// 7. BSON array unmarshals to a bson.A. +// 8. BSON ObjectId unmarshals to a primitive.ObjectID. +// 9. BSON datetime unmarshals to a primitive.DateTime. +// 10. BSON binary unmarshals to a primitive.Binary. +// 11. BSON regular expression unmarshals to a primitive.Regex. +// 12. BSON JavaScript unmarshals to a primitive.JavaScript. +// 13. BSON code with scope unmarshals to a primitive.CodeWithScope. +// 14. BSON timestamp unmarshals to an primitive.Timestamp. +// 15. BSON 128-bit decimal unmarshals to an primitive.Decimal128. +// 16. BSON min key unmarshals to an primitive.MinKey. +// 17. BSON max key unmarshals to an primitive.MaxKey. +// 18. BSON undefined unmarshals to a primitive.Undefined. +// 19. BSON null unmarshals to nil. +// 20. BSON DBPointer unmarshals to a primitive.DBPointer. +// 21. BSON symbol unmarshals to a primitive.Symbol. // // The above mappings also apply when marshalling a D or M to BSON. Some other useful marshalling mappings are: // -// 1. time.Time marshals to a BSON datetime. -// 2. int8, int16, and int32 marshal to a BSON int32. -// 3. int marshals to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, inclusive, and a BSON int64 -// otherwise. -// 4. int64 marshals to BSON int64. -// 5. uint8 and uint16 marshal to a BSON int32. -// 6. uint, uint32, and uint64 marshal to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, -// inclusive, and BSON int64 otherwise. -// 7. BSON null and undefined values will unmarshal into the zero value of a field (e.g. unmarshalling a BSON null or -// undefined value into a string will yield the empty string.). +// 1. time.Time marshals to a BSON datetime. +// 2. int8, int16, and int32 marshal to a BSON int32. +// 3. int marshals to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, inclusive, and a BSON int64 +// otherwise. +// 4. int64 marshals to BSON int64. +// 5. uint8 and uint16 marshal to a BSON int32. +// 6. uint, uint32, and uint64 marshal to a BSON int32 if the value is between math.MinInt32 and math.MaxInt32, +// inclusive, and BSON int64 otherwise. +// 7. BSON null and undefined values will unmarshal into the zero value of a field (e.g. unmarshalling a BSON null or +// undefined value into a string will yield the empty string.). // -// Structs +// # Structs // // Structs can be marshalled/unmarshalled to/from BSON or Extended JSON. When transforming structs to/from BSON or Extended // JSON, the following rules apply: // -// 1. Only exported fields in structs will be marshalled or unmarshalled. +// 1. Only exported fields in structs will be marshalled or unmarshalled. // -// 2. When marshalling a struct, each field will be lowercased to generate the key for the corresponding BSON element. +// 2. When marshalling a struct, each field will be lowercased to generate the key for the corresponding BSON element. // For example, a struct field named "Foo" will generate key "foo". This can be overridden via a struct tag (e.g. // `bson:"fooField"` to generate key "fooField" instead). // -// 3. An embedded struct field is marshalled as a subdocument. The key will be the lowercased name of the field's type. +// 3. An embedded struct field is marshalled as a subdocument. The key will be the lowercased name of the field's type. // -// 4. A pointer field is marshalled as the underlying type if the pointer is non-nil. If the pointer is nil, it is +// 4. A pointer field is marshalled as the underlying type if the pointer is non-nil. If the pointer is nil, it is // marshalled as a BSON null value. // -// 5. When unmarshalling, a field of type interface{} will follow the D/M type mappings listed above. BSON documents +// 5. When unmarshalling, a field of type interface{} will follow the D/M type mappings listed above. BSON documents // unmarshalled into an interface{} field will be unmarshalled as a D. // // The encoding of each struct field can be customized by the "bson" struct tag. @@ -98,13 +100,14 @@ // are not honored, but that can be enabled by creating a StructCodec with JSONFallbackStructTagParser, like below: // // Example: -// structcodec, _ := bsoncodec.NewStructCodec(bsoncodec.JSONFallbackStructTagParser) +// +// structcodec, _ := bsoncodec.NewStructCodec(bsoncodec.JSONFallbackStructTagParser) // // The bson tag gives the name of the field, possibly followed by a comma-separated list of options. // The name may be empty in order to specify options without overriding the default field name. The following options can be used // to configure behavior: // -// 1. omitempty: If the omitempty struct tag is specified on a field, the field will not be marshalled if it is set to +// 1. omitempty: If the omitempty struct tag is specified on a field, the field will not be marshalled if it is set to // the zero value. Fields with language primitive types such as integers, booleans, and strings are considered empty if // their value is equal to the zero value for the type (i.e. 0 for integers, false for booleans, and "" for strings). // Slices, maps, and arrays are considered empty if they are of length zero. Interfaces and pointers are considered @@ -113,16 +116,16 @@ // never considered empty and will be marshalled as embedded documents. // NOTE: It is recommended that this tag be used for all slice and map fields. // -// 2. minsize: If the minsize struct tag is specified on a field of type int64, uint, uint32, or uint64 and the value of +// 2. minsize: If the minsize struct tag is specified on a field of type int64, uint, uint32, or uint64 and the value of // the field can fit in a signed int32, the field will be serialized as a BSON int32 rather than a BSON int64. For other // types, this tag is ignored. // -// 3. truncate: If the truncate struct tag is specified on a field with a non-float numeric type, BSON doubles unmarshalled +// 3. truncate: If the truncate struct tag is specified on a field with a non-float numeric type, BSON doubles unmarshalled // into that field will be truncated at the decimal point. For example, if 3.14 is unmarshalled into a field of type int, // it will be unmarshalled as 3. If this tag is not specified, the decoder will throw an error if the value cannot be // decoded without losing precision. For float64 or non-numeric types, this tag is ignored. // -// 4. inline: If the inline struct tag is specified for a struct or map field, the field will be "flattened" when +// 4. inline: If the inline struct tag is specified for a struct or map field, the field will be "flattened" when // marshalling and "un-flattened" when unmarshalling. This means that all of the fields in that struct/map will be // pulled up one level and will become top-level fields rather than being fields in a nested document. For example, if a // map field named "Map" with value map[string]interface{}{"foo": "bar"} is inlined, the resulting document will be @@ -132,7 +135,7 @@ // This tag can be used with fields that are pointers to structs. If an inlined pointer field is nil, it will not be // marshalled. For fields that are not maps or structs, this tag is ignored. // -// Marshalling and Unmarshalling +// # Marshalling and Unmarshalling // // Manually marshalling and unmarshalling can be done with the Marshal and Unmarshal family of functions. package bson diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go b/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go index ffe4eed07ae4..ba7c9112e9b2 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go @@ -191,10 +191,9 @@ func (d Decimal128) IsNaN() bool { // IsInf returns: // -// +1 d == Infinity -// 0 other case -// -1 d == -Infinity -// +// +1 d == Infinity +// 0 other case +// -1 d == -Infinity func (d Decimal128) IsInf() int { if d.h>>58&(1<<5-1) != 0x1E { return 0 diff --git a/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go b/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go index b3cba1bf9dfc..c72ccc1c4d49 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go +++ b/client/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go @@ -182,7 +182,7 @@ type MaxKey struct{} // // Example usage: // -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} +// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} type D []E // Map creates a map from the elements of the D. @@ -206,12 +206,12 @@ type E struct { // // Example usage: // -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} +// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} type M map[string]interface{} // An A is an ordered representation of a BSON array. // // Example usage: // -// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} +// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} type A []interface{} diff --git a/client/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go b/client/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go index 6c858a010992..e35bd0cd9ad3 100644 --- a/client/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go +++ b/client/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/document_sequence.go @@ -96,8 +96,8 @@ func (ds *DocumentSequence) Empty() bool { } } -//ResetIterator resets the iteration point for the Next method to the beginning of the document -//sequence. +// ResetIterator resets the iteration point for the Next method to the beginning of the document +// sequence. func (ds *DocumentSequence) ResetIterator() { if ds == nil { return diff --git a/client/vendor/gopkg.in/yaml.v2/apic.go b/client/vendor/gopkg.in/yaml.v2/apic.go index acf71402cf31..fb2821e1e667 100644 --- a/client/vendor/gopkg.in/yaml.v2/apic.go +++ b/client/vendor/gopkg.in/yaml.v2/apic.go @@ -143,7 +143,7 @@ func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { emitter.canonical = canonical } -//// Set the indentation increment. +// // Set the indentation increment. func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { if indent < 2 || indent > 9 { indent = 2 diff --git a/client/vendor/gopkg.in/yaml.v2/emitterc.go b/client/vendor/gopkg.in/yaml.v2/emitterc.go index a1c2cc52627f..638a268c79bf 100644 --- a/client/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/client/vendor/gopkg.in/yaml.v2/emitterc.go @@ -130,10 +130,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true diff --git a/client/vendor/gopkg.in/yaml.v2/parserc.go b/client/vendor/gopkg.in/yaml.v2/parserc.go index 81d05dfe573f..2883e5c58fab 100644 --- a/client/vendor/gopkg.in/yaml.v2/parserc.go +++ b/client/vendor/gopkg.in/yaml.v2/parserc.go @@ -170,7 +170,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -192,9 +193,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -277,8 +281,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -299,9 +303,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -332,30 +337,41 @@ func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -574,8 +590,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -627,7 +643,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -664,14 +681,14 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -723,13 +740,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -757,16 +772,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -825,11 +842,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -849,8 +865,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -873,8 +889,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -891,16 +907,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -965,8 +982,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/client/vendor/gopkg.in/yaml.v2/readerc.go b/client/vendor/gopkg.in/yaml.v2/readerc.go index 7c1f5fac3dbd..b0c436c4a84d 100644 --- a/client/vendor/gopkg.in/yaml.v2/readerc.go +++ b/client/vendor/gopkg.in/yaml.v2/readerc.go @@ -95,7 +95,7 @@ func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { // [Go] This function was changed to guarantee the requested length size at EOF. // The fact we need to do this is pretty awful, but the description above implies - // for that to be the case, and there are tests + // for that to be the case, and there are tests // If the EOF flag is set and the raw buffer is empty, do nothing. if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { diff --git a/client/vendor/gopkg.in/yaml.v2/resolve.go b/client/vendor/gopkg.in/yaml.v2/resolve.go index 4120e0c9160a..e29c364b3399 100644 --- a/client/vendor/gopkg.in/yaml.v2/resolve.go +++ b/client/vendor/gopkg.in/yaml.v2/resolve.go @@ -180,7 +180,7 @@ func resolve(tag string, in string) (rtag string, out interface{}) { return yaml_INT_TAG, uintv } } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt("-" + plain[3:], 2, 64) + intv, err := strconv.ParseInt("-"+plain[3:], 2, 64) if err == nil { if true || intv == int64(int(intv)) { return yaml_INT_TAG, int(intv) diff --git a/client/vendor/gopkg.in/yaml.v2/scannerc.go b/client/vendor/gopkg.in/yaml.v2/scannerc.go index 0b9bb6030a0f..d634dca4b04a 100644 --- a/client/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/client/vendor/gopkg.in/yaml.v2/scannerc.go @@ -1500,11 +1500,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1601,11 +1601,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1640,8 +1640,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1679,10 +1680,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1716,9 +1718,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte diff --git a/client/vendor/gopkg.in/yaml.v2/sorter.go b/client/vendor/gopkg.in/yaml.v2/sorter.go index 4c45e660a8f2..2edd734055fb 100644 --- a/client/vendor/gopkg.in/yaml.v2/sorter.go +++ b/client/vendor/gopkg.in/yaml.v2/sorter.go @@ -52,7 +52,7 @@ func (l keyList) Less(i, j int) bool { var ai, bi int var an, bn int64 if ar[i] == '0' || br[i] == '0' { - for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- { + for j := i - 1; j >= 0 && unicode.IsDigit(ar[j]); j-- { if ar[j] != '0' { an = 1 bn = 1 diff --git a/client/vendor/gopkg.in/yaml.v2/yaml.go b/client/vendor/gopkg.in/yaml.v2/yaml.go index 30813884c067..03756f6bbbc8 100644 --- a/client/vendor/gopkg.in/yaml.v2/yaml.go +++ b/client/vendor/gopkg.in/yaml.v2/yaml.go @@ -2,8 +2,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -67,16 +66,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -166,36 +164,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() diff --git a/client/vendor/gopkg.in/yaml.v2/yamlh.go b/client/vendor/gopkg.in/yaml.v2/yamlh.go index f6a9c8e34b1e..640f9d95de93 100644 --- a/client/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/client/vendor/gopkg.in/yaml.v2/yamlh.go @@ -408,7 +408,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -604,13 +606,14 @@ type yaml_parser_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/client/vendor/gopkg.in/yaml.v3/apic.go b/client/vendor/gopkg.in/yaml.v3/apic.go index ae7d049f182a..05fd305da165 100644 --- a/client/vendor/gopkg.in/yaml.v3/apic.go +++ b/client/vendor/gopkg.in/yaml.v3/apic.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/client/vendor/gopkg.in/yaml.v3/emitterc.go b/client/vendor/gopkg.in/yaml.v3/emitterc.go index 0f47c9ca8add..dde20e5079dd 100644 --- a/client/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/client/vendor/gopkg.in/yaml.v3/emitterc.go @@ -162,10 +162,9 @@ func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { // Check if we need to accumulate more events before emitting. // // We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// +// - 1 event for DOCUMENT-START +// - 2 events for SEQUENCE-START +// - 3 events for MAPPING-START func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { if emitter.events_head == len(emitter.events) { return true @@ -241,7 +240,7 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent += 2 } else { // Everything else aligns to the chosen indentation. - emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) + emitter.indent = emitter.best_indent * ((emitter.indent + emitter.best_indent) / emitter.best_indent) } } return true diff --git a/client/vendor/gopkg.in/yaml.v3/parserc.go b/client/vendor/gopkg.in/yaml.v3/parserc.go index 268558a0d632..25fe823637ab 100644 --- a/client/vendor/gopkg.in/yaml.v3/parserc.go +++ b/client/vendor/gopkg.in/yaml.v3/parserc.go @@ -227,7 +227,8 @@ func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool // Parse the production: // stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ +// +// ************ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -249,9 +250,12 @@ func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// * +// +// * +// // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* +// +// ************************* func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { token := peek_token(parser) @@ -356,8 +360,8 @@ func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t // Parse the productions: // explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** // +// *********** func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -379,9 +383,10 @@ func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event // Parse the productions: // implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* // +// ************* +// +// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -428,30 +433,41 @@ func yaml_parser_set_event_comments(parser *yaml_parser_t, event *yaml_event_t) // Parse the productions: // block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * +// +// ALIAS +// ***** +// | properties (block_content | indentless_block_sequence)? +// ********** * +// | block_content | indentless_block_sequence +// * +// // block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * +// +// ***** +// | properties block_content? +// ********** * +// | block_content +// * +// // flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * +// +// ***** +// | properties flow_content? +// ********** * +// | flow_content +// * +// // properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* +// +// ************************* +// // block_content ::= block_collection | flow_collection | SCALAR -// ****** +// +// ****** +// // flow_content ::= flow_collection | SCALAR -// ****** +// +// ****** func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() @@ -682,8 +698,8 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i // Parse the productions: // block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* // +// ******************** *********** * ********* func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -740,7 +756,8 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e // Parse the productions: // indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * +// +// *********** * func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -805,14 +822,14 @@ func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* // -// BLOCK-END -// ********* +// ******************* +// ((KEY block_node_or_indentless_sequence?)? +// *** * +// (VALUE block_node_or_indentless_sequence?)?)* // +// BLOCK-END +// ********* func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -881,13 +898,11 @@ func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_even // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// +// ((KEY block_node_or_indentless_sequence?)? // +// (VALUE block_node_or_indentless_sequence?)?)* +// ***** * +// BLOCK-END func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -915,16 +930,18 @@ func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_ev // Parse the productions: // flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** +// +// ******************* +// (flow_sequence_entry FLOW-ENTRY)* +// * ********** +// flow_sequence_entry? +// * +// FLOW-SEQUENCE-END +// ***************** +// // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -987,11 +1004,10 @@ func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_ev return true } -// // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * // +// *** * func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1011,8 +1027,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, ev // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * // +// ***** * func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1035,8 +1051,8 @@ func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, // Parse the productions: // flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * // +// * func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { token := peek_token(parser) if token == nil { @@ -1053,16 +1069,17 @@ func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, ev // Parse the productions: // flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * // +// ****************** +// (flow_mapping_entry FLOW-ENTRY)* +// * ********** +// flow_mapping_entry? +// ****************** +// FLOW-MAPPING-END +// **************** +// +// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +// - *** * func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { if first { token := peek_token(parser) @@ -1128,8 +1145,7 @@ func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event // Parse the productions: // flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// +// - ***** * func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { token := peek_token(parser) if token == nil { diff --git a/client/vendor/gopkg.in/yaml.v3/readerc.go b/client/vendor/gopkg.in/yaml.v3/readerc.go index b7de0a89c462..56af245366f2 100644 --- a/client/vendor/gopkg.in/yaml.v3/readerc.go +++ b/client/vendor/gopkg.in/yaml.v3/readerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/client/vendor/gopkg.in/yaml.v3/scannerc.go b/client/vendor/gopkg.in/yaml.v3/scannerc.go index ca0070108f4e..30b1f08920a0 100644 --- a/client/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/client/vendor/gopkg.in/yaml.v3/scannerc.go @@ -1614,11 +1614,11 @@ func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { // Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %YAML 1.1 # a comment \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { // Eat '%'. start_mark := parser.mark @@ -1719,11 +1719,11 @@ func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool // Scan the directive name. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ // +// %YAML 1.1 # a comment \n +// ^^^^ +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { // Consume the directive name. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1758,8 +1758,9 @@ func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark // Scan the value of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ +// +// %YAML 1.1 # a comment \n +// ^^^^^^ func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { // Eat whitespaces. if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -1797,10 +1798,11 @@ const max_number_length = 2 // Scan the version number of VERSION-DIRECTIVE. // // Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ +// +// %YAML 1.1 # a comment \n +// ^ +// %YAML 1.1 # a comment \n +// ^ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { // Repeat while the next character is digit. @@ -1834,9 +1836,9 @@ func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark // Scan the value of a TAG-DIRECTIVE token. // // Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // +// %TAG !yaml! tag:yaml.org,2002: \n +// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { var handle_value, prefix_value []byte @@ -2847,7 +2849,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t continue } if parser.buffer[parser.buffer_pos+peek] == '#' { - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false @@ -2876,7 +2878,7 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t parser.comments = append(parser.comments, yaml_comment_t{ token_mark: token_mark, start_mark: start_mark, - line: text, + line: text, }) } return true @@ -2910,7 +2912,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo // the foot is the line below it. var foot_line = -1 if scan_mark.line > 0 { - foot_line = parser.mark.line-parser.newlines+1 + foot_line = parser.mark.line - parser.newlines + 1 if parser.newlines == 0 && parser.mark.column > 1 { foot_line++ } @@ -2996,7 +2998,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo recent_empty = false // Consume until after the consumed comment line. - seen := parser.mark.index+peek + seen := parser.mark.index + peek for { if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { return false diff --git a/client/vendor/gopkg.in/yaml.v3/writerc.go b/client/vendor/gopkg.in/yaml.v3/writerc.go index b8a116bf9a22..266d0b092c03 100644 --- a/client/vendor/gopkg.in/yaml.v3/writerc.go +++ b/client/vendor/gopkg.in/yaml.v3/writerc.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/client/vendor/gopkg.in/yaml.v3/yaml.go b/client/vendor/gopkg.in/yaml.v3/yaml.go index 8cec6da48d3e..f0bedf3d63c9 100644 --- a/client/vendor/gopkg.in/yaml.v3/yaml.go +++ b/client/vendor/gopkg.in/yaml.v3/yaml.go @@ -17,8 +17,7 @@ // // Source code and other details for the project are available at GitHub: // -// https://github.com/go-yaml/yaml -// +// https://github.com/go-yaml/yaml package yaml import ( @@ -75,16 +74,15 @@ type Marshaler interface { // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// var t T +// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) // // See the documentation of Marshal for the format of tags and a list of // supported tag options. -// func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } @@ -185,36 +183,35 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // The field tag format accepted is: // -// `(...) yaml:"[][,[,]]" (...)` +// `(...) yaml:"[][,[,]]" (...)` // // The following flags are currently supported: // -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Zero valued structs will be omitted if all their public -// fields are zero, unless they implement an IsZero -// method (see the IsZeroer interface type), in which -// case the field will be excluded if IsZero returns true. +// omitempty Only include the field if it's not set to the zero +// value for the type or to empty slices or maps. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be excluded if IsZero returns true. // -// flow Marshal using a flow style (useful for structs, -// sequences and maps). +// flow Marshal using a flow style (useful for structs, +// sequences and maps). // -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. +// inline Inline the field, which must be a struct or a map, +// causing all of its fields or keys to be processed as if +// they were part of the outer struct. For maps, keys must +// not conflict with the yaml keys of other struct fields. // // In addition, if the key is "-", the field is ignored. // // For example: // -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// +// type T struct { +// F int `yaml:"a,omitempty"` +// B int +// } +// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" +// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() @@ -358,22 +355,21 @@ const ( // // For example: // -// var person struct { -// Name string -// Address yaml.Node -// } -// err := yaml.Unmarshal(data, &person) -// -// Or by itself: +// var person struct { +// Name string +// Address yaml.Node +// } +// err := yaml.Unmarshal(data, &person) // -// var person Node -// err := yaml.Unmarshal(data, &person) +// Or by itself: // +// var person Node +// err := yaml.Unmarshal(data, &person) type Node struct { // Kind defines whether the node is a document, a mapping, a sequence, // a scalar value, or an alias to another node. The specific data type of // scalar nodes may be obtained via the ShortTag and LongTag methods. - Kind Kind + Kind Kind // Style allows customizing the apperance of the node in the tree. Style Style @@ -421,7 +417,6 @@ func (n *Node) IsZero() bool { n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 } - // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. diff --git a/client/vendor/gopkg.in/yaml.v3/yamlh.go b/client/vendor/gopkg.in/yaml.v3/yamlh.go index 7c6d00770619..ddcd5513ba77 100644 --- a/client/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/client/vendor/gopkg.in/yaml.v3/yamlh.go @@ -438,7 +438,9 @@ type yaml_document_t struct { // The number of written bytes should be set to the size_read variable. // // [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). +// +// yaml_parser_set_input(). +// // [out] buffer The buffer to write the data from the source. // [in] size The size of the buffer. // [out] size_read The actual number of bytes read from the source. @@ -639,7 +641,6 @@ type yaml_parser_t struct { } type yaml_comment_t struct { - scan_mark yaml_mark_t // Position where scanning for comments started token_mark yaml_mark_t // Position after which tokens will be associated with this comment start_mark yaml_mark_t // Position of '#' comment mark @@ -659,13 +660,14 @@ type yaml_comment_t struct { // @a buffer to the output. // // @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). +// +// yaml_emitter_set_output(). +// // @param[in] buffer The buffer with bytes to be written. // @param[in] size The size of the buffer. // // @returns On success, the handler should return @c 1. If the handler failed, // the returned value should be @c 0. -// type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error type yaml_emitter_state_t int diff --git a/client/vendor/gopkg.in/yaml.v3/yamlprivateh.go b/client/vendor/gopkg.in/yaml.v3/yamlprivateh.go index e88f9c54aecb..dea1ba9610df 100644 --- a/client/vendor/gopkg.in/yaml.v3/yamlprivateh.go +++ b/client/vendor/gopkg.in/yaml.v3/yamlprivateh.go @@ -1,17 +1,17 @@ -// +// // Copyright (c) 2011-2019 Canonical Ltd // Copyright (c) 2006-2010 Kirill Simonov -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies // of the Software, and to permit persons to whom the Software is furnished to do // so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -137,8 +137,8 @@ func is_crlf(b []byte, i int) bool { func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( - // is_break: - b[i] == '\r' || // CR (#xD) + // is_break: + b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) @@ -151,8 +151,8 @@ func is_breakz(b []byte, i int) bool { func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( - // is_space: - b[i] == ' ' || + // is_space: + b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) @@ -166,8 +166,8 @@ func is_spacez(b []byte, i int) bool { func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( - // is_blank: - b[i] == ' ' || b[i] == '\t' || + // is_blank: + b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) diff --git a/client/vendor/gorm.io/gorm/model.go b/client/vendor/gorm.io/gorm/model.go index 3334d17cb1a4..fa705df1cd05 100644 --- a/client/vendor/gorm.io/gorm/model.go +++ b/client/vendor/gorm.io/gorm/model.go @@ -4,9 +4,10 @@ import "time" // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt // It may be embedded into your model or you may build your own model without it -// type User struct { -// gorm.Model -// } +// +// type User struct { +// gorm.Model +// } type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time diff --git a/client/vendor/gorm.io/gorm/schema/relationship.go b/client/vendor/gorm.io/gorm/schema/relationship.go index 9436f28319c4..9781d3f66337 100644 --- a/client/vendor/gorm.io/gorm/schema/relationship.go +++ b/client/vendor/gorm.io/gorm/schema/relationship.go @@ -123,16 +123,17 @@ func (schema *Schema) parseRelation(field *Field) *Relationship { } // User has many Toys, its `Polymorphic` is `Owner`, Pet has one Toy, its `Polymorphic` is `Owner` -// type User struct { -// Toys []Toy `gorm:"polymorphic:Owner;"` -// } -// type Pet struct { -// Toy Toy `gorm:"polymorphic:Owner;"` -// } -// type Toy struct { -// OwnerID int -// OwnerType string -// } +// +// type User struct { +// Toys []Toy `gorm:"polymorphic:Owner;"` +// } +// type Pet struct { +// Toy Toy `gorm:"polymorphic:Owner;"` +// } +// type Toy struct { +// OwnerID int +// OwnerType string +// } func (schema *Schema) buildPolymorphicRelation(relation *Relationship, field *Field, polymorphic string) { relation.Polymorphic = &Polymorphic{ Value: schema.Table, diff --git a/cmd/graphstatemachine/main.go b/cmd/graphstatemachine/main.go index 131b3aadf3c4..a34a51d4d7af 100644 --- a/cmd/graphstatemachine/main.go +++ b/cmd/graphstatemachine/main.go @@ -4,9 +4,9 @@ import ( "fmt" "github.com/filanov/stateswitch" - "github.com/golang/mock/gomock" "github.com/openshift/assisted-service/internal/cluster" "github.com/openshift/assisted-service/internal/host" + "go.uber.org/mock/gomock" ) func main() { diff --git a/go.mod b/go.mod index 6a86a3113839..c333218d888b 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,6 @@ require ( github.com/go-openapi/validate v0.24.0 github.com/golang-collections/go-datastructures v0.0.0-20150211160725-59788d5eb259 github.com/golang-jwt/jwt/v4 v4.5.2 - github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.7.0 github.com/google/renameio v1.0.1 github.com/google/uuid v1.6.0 @@ -76,6 +75,7 @@ require ( github.com/thedevsaddam/retry v1.2.1 github.com/thoas/go-funk v0.9.3 github.com/vincent-petithory/dataurl v1.0.0 + go.uber.org/mock v0.6.0 golang.org/x/crypto v0.44.0 golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 golang.org/x/sync v0.18.0 @@ -114,7 +114,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/google/btree v1.1.3 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/google/btree v1.0.1 // indirect github.com/google/cel-go v0.17.7 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/gofuzz v1.2.0 // indirect diff --git a/go.sum b/go.sum index 8bdeb2227959..9e447ffc06f7 100644 --- a/go.sum +++ b/go.sum @@ -583,8 +583,8 @@ github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9/go.mod h1:XA3DeT6rxh2 github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9/go.mod h1:0EXg4mc1CNP0HCqCz+K4ts155PXIlUywf0wqN+GfPZw= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= -github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= +github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= github.com/google/cel-go v0.17.7 h1:6ebJFzu1xO2n7TLtN+UBqShGBhlD85bhvglh5DpcfqQ= github.com/google/cel-go v0.17.7/go.mod h1:HXZKzB0LXqer5lHHgfWAnlYwJaQBDKMjxjulNQzhwhY= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= @@ -1394,6 +1394,8 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= +go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= diff --git a/hack/setup_env.sh b/hack/setup_env.sh index 2b5c9d176144..da6551a0b504 100755 --- a/hack/setup_env.sh +++ b/hack/setup_env.sh @@ -61,7 +61,7 @@ function envtest() { function test_tools() { go install github.com/onsi/ginkgo/ginkgo@v1.16.4 - go install github.com/golang/mock/mockgen@v1.6.0 + go install go.uber.org/mock/mockgen@v0.6.0 go install github.com/vektra/mockery/v2@v2.12.3 go install gotest.tools/gotestsum@v1.6.3 go install github.com/axw/gocov/gocov@v1.1.0 diff --git a/internal/bminventory/inventory_test.go b/internal/bminventory/inventory_test.go index e68509938c77..2794961dc8de 100644 --- a/internal/bminventory/inventory_test.go +++ b/internal/bminventory/inventory_test.go @@ -29,7 +29,6 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -83,6 +82,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/sirupsen/logrus/hooks/test" + "go.uber.org/mock/gomock" "gorm.io/gorm" "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/bminventory/mock_crd_utils.go b/internal/bminventory/mock_crd_utils.go index 8ca82f709293..3a7d3be0d8f5 100644 --- a/internal/bminventory/mock_crd_utils.go +++ b/internal/bminventory/mock_crd_utils.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) // MockCRDUtils is a mock of CRDUtils interface. diff --git a/internal/bminventory/mock_installer_internal.go b/internal/bminventory/mock_installer_internal.go index 71a176fe1c27..acb0d80da99a 100644 --- a/internal/bminventory/mock_installer_internal.go +++ b/internal/bminventory/mock_installer_internal.go @@ -10,10 +10,10 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" installer "github.com/openshift/assisted-service/restapi/operations/installer" + gomock "go.uber.org/mock/gomock" types "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/cluster/cluster_test.go b/internal/cluster/cluster_test.go index 0819cff08f56..142f87891084 100644 --- a/internal/cluster/cluster_test.go +++ b/internal/cluster/cluster_test.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -41,6 +40,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/cluster/common_test.go b/internal/cluster/common_test.go index b167e80d6e21..d28d11790ae9 100644 --- a/internal/cluster/common_test.go +++ b/internal/cluster/common_test.go @@ -6,13 +6,13 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" commontesting "github.com/openshift/assisted-service/internal/common/testing" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/cluster/mock_cluster_api.go b/internal/cluster/mock_cluster_api.go index 7afdbadac6d0..3cb228023c92 100644 --- a/internal/cluster/mock_cluster_api.go +++ b/internal/cluster/mock_cluster_api.go @@ -9,10 +9,10 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" s3wrapper "github.com/openshift/assisted-service/pkg/s3wrapper" + gomock "go.uber.org/mock/gomock" gorm "gorm.io/gorm" types "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/cluster/mock_transition.go b/internal/cluster/mock_transition.go index dd9b7bc97ebd..f3df469e777f 100644 --- a/internal/cluster/mock_transition.go +++ b/internal/cluster/mock_transition.go @@ -9,7 +9,7 @@ import ( reflect "reflect" stateswitch "github.com/filanov/stateswitch" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockTransitionHandler is a mock of TransitionHandler interface. diff --git a/internal/cluster/progress_test.go b/internal/cluster/progress_test.go index a3cedf4ba959..cff701ad16a5 100644 --- a/internal/cluster/progress_test.go +++ b/internal/cluster/progress_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -23,6 +22,7 @@ import ( "github.com/openshift/assisted-service/internal/operators" "github.com/openshift/assisted-service/internal/operators/api" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/cluster/refresh_status_preprocessor_test.go b/internal/cluster/refresh_status_preprocessor_test.go index 240e82254ff3..3b1840b5c441 100644 --- a/internal/cluster/refresh_status_preprocessor_test.go +++ b/internal/cluster/refresh_status_preprocessor_test.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,6 +16,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/cluster/transition_test.go b/internal/cluster/transition_test.go index f3cef91663a5..d9d69d5b3397 100644 --- a/internal/cluster/transition_test.go +++ b/internal/cluster/transition_test.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -34,6 +33,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/cluster/validations/mock_pull_secret_validation.go b/internal/cluster/validations/mock_pull_secret_validation.go index d1cdbda39fec..709cfdc12f56 100644 --- a/internal/cluster/validations/mock_pull_secret_validation.go +++ b/internal/cluster/validations/mock_pull_secret_validation.go @@ -7,7 +7,7 @@ package validations import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockPullSecretValidator is a mock of PullSecretValidator interface. diff --git a/internal/cluster/validator_test.go b/internal/cluster/validator_test.go index 413102fb62a8..6f9dff5294b1 100644 --- a/internal/cluster/validator_test.go +++ b/internal/cluster/validator_test.go @@ -6,7 +6,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,6 +15,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" ) var _ = Describe("isNetworksSameAddressFamilies", func() { diff --git a/internal/common/events/events.go b/internal/common/events/events.go index 4bade81c9fc7..e4c63a2c6fed 100644 --- a/internal/common/events/events.go +++ b/internal/common/events/events.go @@ -2,6783 +2,6466 @@ package events import ( - "context" - "fmt" - "strings" - "time" - eventsapi "github.com/openshift/assisted-service/internal/events/api" + "context" + "fmt" + eventsapi "github.com/openshift/assisted-service/internal/events/api" + "strings" + "time" - "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// // Event cancel_install_start_failed -// type CancelInstallStartFailedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var CancelInstallStartFailedEventName string = "cancel_install_start_failed" func NewCancelInstallStartFailedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *CancelInstallStartFailedEvent { - return &CancelInstallStartFailedEvent{ - eventName: CancelInstallStartFailedEventName, - ClusterId: clusterId, - } + return &CancelInstallStartFailedEvent{ + eventName: CancelInstallStartFailedEventName, + ClusterId: clusterId, + } } func SendCancelInstallStartFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewCancelInstallStartFailedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewCancelInstallStartFailedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendCancelInstallStartFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewCancelInstallStartFailedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewCancelInstallStartFailedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *CancelInstallStartFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *CancelInstallStartFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *CancelInstallStartFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *CancelInstallStartFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *CancelInstallStartFailedEvent) FormatMessage() string { - s := "Failed to cancel installation: error starting DB transaction" - return e.format(&s) + s := "Failed to cancel installation: error starting DB transaction" + return e.format(&s) } -// // Event cancel_install_commit_failed -// type CancelInstallCommitFailedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var CancelInstallCommitFailedEventName string = "cancel_install_commit_failed" func NewCancelInstallCommitFailedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *CancelInstallCommitFailedEvent { - return &CancelInstallCommitFailedEvent{ - eventName: CancelInstallCommitFailedEventName, - ClusterId: clusterId, - } + return &CancelInstallCommitFailedEvent{ + eventName: CancelInstallCommitFailedEventName, + ClusterId: clusterId, + } } func SendCancelInstallCommitFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewCancelInstallCommitFailedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewCancelInstallCommitFailedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendCancelInstallCommitFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewCancelInstallCommitFailedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewCancelInstallCommitFailedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *CancelInstallCommitFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *CancelInstallCommitFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *CancelInstallCommitFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *CancelInstallCommitFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *CancelInstallCommitFailedEvent) FormatMessage() string { - s := "Failed to cancel installation: error committing DB transaction" - return e.format(&s) + s := "Failed to cancel installation: error committing DB transaction" + return e.format(&s) } -// // Event host_registration_setting_properties_failed -// type HostRegistrationSettingPropertiesFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID } var HostRegistrationSettingPropertiesFailedEventName string = "host_registration_setting_properties_failed" func NewHostRegistrationSettingPropertiesFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, ) *HostRegistrationSettingPropertiesFailedEvent { - return &HostRegistrationSettingPropertiesFailedEvent{ - eventName: HostRegistrationSettingPropertiesFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - } + return &HostRegistrationSettingPropertiesFailedEvent{ + eventName: HostRegistrationSettingPropertiesFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + } } func SendHostRegistrationSettingPropertiesFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID,) { - ev := NewHostRegistrationSettingPropertiesFailedEvent( - hostId, - infraEnvId, - clusterId, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID) { + ev := NewHostRegistrationSettingPropertiesFailedEvent( + hostId, + infraEnvId, + clusterId, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostRegistrationSettingPropertiesFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - eventTime time.Time) { - ev := NewHostRegistrationSettingPropertiesFailedEvent( - hostId, - infraEnvId, - clusterId, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + eventTime time.Time) { + ev := NewHostRegistrationSettingPropertiesFailedEvent( + hostId, + infraEnvId, + clusterId, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostRegistrationSettingPropertiesFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostRegistrationSettingPropertiesFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostRegistrationSettingPropertiesFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostRegistrationSettingPropertiesFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostRegistrationSettingPropertiesFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostRegistrationSettingPropertiesFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *HostRegistrationSettingPropertiesFailedEvent) FormatMessage() string { - s := "Failed to register host: error setting host properties" - return e.format(&s) + s := "Failed to register host: error setting host properties" + return e.format(&s) } -// // Event host_media_disconnected -// type HostMediaDisconnectedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID } var HostMediaDisconnectedEventName string = "host_media_disconnected" func NewHostMediaDisconnectedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, ) *HostMediaDisconnectedEvent { - return &HostMediaDisconnectedEvent{ - eventName: HostMediaDisconnectedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - } + return &HostMediaDisconnectedEvent{ + eventName: HostMediaDisconnectedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + } } func SendHostMediaDisconnectedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID,) { - ev := NewHostMediaDisconnectedEvent( - hostId, - infraEnvId, - clusterId, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID) { + ev := NewHostMediaDisconnectedEvent( + hostId, + infraEnvId, + clusterId, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostMediaDisconnectedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - eventTime time.Time) { - ev := NewHostMediaDisconnectedEvent( - hostId, - infraEnvId, - clusterId, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + eventTime time.Time) { + ev := NewHostMediaDisconnectedEvent( + hostId, + infraEnvId, + clusterId, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostMediaDisconnectedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostMediaDisconnectedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostMediaDisconnectedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostMediaDisconnectedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostMediaDisconnectedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostMediaDisconnectedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *HostMediaDisconnectedEvent) FormatMessage() string { - s := "Unable to read from the discovery media. It was either disconnected or poor network conditions prevented it from being read. Try using the minimal ISO option and be sure to keep the media connected until the installation is completed" - return e.format(&s) + s := "Unable to read from the discovery media. It was either disconnected or poor network conditions prevented it from being read. Try using the minimal ISO option and be sure to keep the media connected until the installation is completed" + return e.format(&s) } -// // Event cluster_registration_succeeded -// type ClusterRegistrationSucceededEvent struct { - eventName string - ClusterId strfmt.UUID - ClusterKind string + eventName string + ClusterId strfmt.UUID + ClusterKind string } var ClusterRegistrationSucceededEventName string = "cluster_registration_succeeded" func NewClusterRegistrationSucceededEvent( - clusterId strfmt.UUID, - clusterKind string, + clusterId strfmt.UUID, + clusterKind string, ) *ClusterRegistrationSucceededEvent { - return &ClusterRegistrationSucceededEvent{ - eventName: ClusterRegistrationSucceededEventName, - ClusterId: clusterId, - ClusterKind: clusterKind, - } + return &ClusterRegistrationSucceededEvent{ + eventName: ClusterRegistrationSucceededEventName, + ClusterId: clusterId, + ClusterKind: clusterKind, + } } func SendClusterRegistrationSucceededEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - clusterKind string,) { - ev := NewClusterRegistrationSucceededEvent( - clusterId, - clusterKind, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + clusterKind string) { + ev := NewClusterRegistrationSucceededEvent( + clusterId, + clusterKind, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterRegistrationSucceededEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - clusterKind string, - eventTime time.Time) { - ev := NewClusterRegistrationSucceededEvent( - clusterId, - clusterKind, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + clusterKind string, + eventTime time.Time) { + ev := NewClusterRegistrationSucceededEvent( + clusterId, + clusterKind, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterRegistrationSucceededEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterRegistrationSucceededEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterRegistrationSucceededEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterRegistrationSucceededEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{cluster_kind}", fmt.Sprint(e.ClusterKind), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{cluster_kind}", fmt.Sprint(e.ClusterKind), + ) + return r.Replace(*message) } func (e *ClusterRegistrationSucceededEvent) FormatMessage() string { - s := "Successfully registered cluster" - return e.format(&s) + s := "Successfully registered cluster" + return e.format(&s) } -// // Event cluster_deregister_failed -// type ClusterDeregisterFailedEvent struct { - eventName string - ClusterId strfmt.UUID - Error string + eventName string + ClusterId strfmt.UUID + Error string } var ClusterDeregisterFailedEventName string = "cluster_deregister_failed" func NewClusterDeregisterFailedEvent( - clusterId strfmt.UUID, - error string, + clusterId strfmt.UUID, + error string, ) *ClusterDeregisterFailedEvent { - return &ClusterDeregisterFailedEvent{ - eventName: ClusterDeregisterFailedEventName, - ClusterId: clusterId, - Error: error, - } + return &ClusterDeregisterFailedEvent{ + eventName: ClusterDeregisterFailedEventName, + ClusterId: clusterId, + Error: error, + } } func SendClusterDeregisterFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string,) { - ev := NewClusterDeregisterFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string) { + ev := NewClusterDeregisterFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterDeregisterFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewClusterDeregisterFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewClusterDeregisterFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterDeregisterFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterDeregisterFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *ClusterDeregisterFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterDeregisterFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *ClusterDeregisterFailedEvent) FormatMessage() string { - s := "Failed to deregister cluster. Error: {error}" - return e.format(&s) + s := "Failed to deregister cluster. Error: {error}" + return e.format(&s) } -// // Event cluster_deregistered -// type ClusterDeregisteredEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterDeregisteredEventName string = "cluster_deregistered" func NewClusterDeregisteredEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterDeregisteredEvent { - return &ClusterDeregisteredEvent{ - eventName: ClusterDeregisteredEventName, - ClusterId: clusterId, - } + return &ClusterDeregisteredEvent{ + eventName: ClusterDeregisteredEventName, + ClusterId: clusterId, + } } func SendClusterDeregisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterDeregisteredEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterDeregisteredEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterDeregisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterDeregisteredEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterDeregisteredEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterDeregisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterDeregisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterDeregisteredEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterDeregisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterDeregisteredEvent) FormatMessage() string { - s := "Deregistered cluster" - return e.format(&s) + s := "Deregistered cluster" + return e.format(&s) } -// // Event cluster_validation_failed -// type ClusterValidationFailedEvent struct { - eventName string - ClusterId strfmt.UUID - ValidationId string - ValidationMsg string - FailureMessage string + eventName string + ClusterId strfmt.UUID + ValidationId string + ValidationMsg string + FailureMessage string } var ClusterValidationFailedEventName string = "cluster_validation_failed" func NewClusterValidationFailedEvent( - clusterId strfmt.UUID, - validationId string, - validationMsg string, - failureMessage string, + clusterId strfmt.UUID, + validationId string, + validationMsg string, + failureMessage string, ) *ClusterValidationFailedEvent { - return &ClusterValidationFailedEvent{ - eventName: ClusterValidationFailedEventName, - ClusterId: clusterId, - ValidationId: validationId, - ValidationMsg: validationMsg, - FailureMessage: failureMessage, - } + return &ClusterValidationFailedEvent{ + eventName: ClusterValidationFailedEventName, + ClusterId: clusterId, + ValidationId: validationId, + ValidationMsg: validationMsg, + FailureMessage: failureMessage, + } } func SendClusterValidationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - validationId string, - validationMsg string, - failureMessage string,) { - ev := NewClusterValidationFailedEvent( - clusterId, - validationId, - validationMsg, - failureMessage, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + validationId string, + validationMsg string, + failureMessage string) { + ev := NewClusterValidationFailedEvent( + clusterId, + validationId, + validationMsg, + failureMessage, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterValidationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - validationId string, - validationMsg string, - failureMessage string, - eventTime time.Time) { - ev := NewClusterValidationFailedEvent( - clusterId, - validationId, - validationMsg, - failureMessage, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + validationId string, + validationMsg string, + failureMessage string, + eventTime time.Time) { + ev := NewClusterValidationFailedEvent( + clusterId, + validationId, + validationMsg, + failureMessage, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterValidationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterValidationFailedEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *ClusterValidationFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterValidationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{validation_id}", fmt.Sprint(e.ValidationId), - "{validation_msg}", fmt.Sprint(e.ValidationMsg), - "{failure_message}", fmt.Sprint(e.FailureMessage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{validation_id}", fmt.Sprint(e.ValidationId), + "{validation_msg}", fmt.Sprint(e.ValidationMsg), + "{failure_message}", fmt.Sprint(e.FailureMessage), + ) + return r.Replace(*message) } func (e *ClusterValidationFailedEvent) FormatMessage() string { - s := "Cluster validation '{validation_id}' {failure_message}" - return e.format(&s) + s := "Cluster validation '{validation_id}' {failure_message}" + return e.format(&s) } -// // Event cluster_validation_fixed -// type ClusterValidationFixedEvent struct { - eventName string - ClusterId strfmt.UUID - ValidationId string - ValidationMsg string + eventName string + ClusterId strfmt.UUID + ValidationId string + ValidationMsg string } var ClusterValidationFixedEventName string = "cluster_validation_fixed" func NewClusterValidationFixedEvent( - clusterId strfmt.UUID, - validationId string, - validationMsg string, + clusterId strfmt.UUID, + validationId string, + validationMsg string, ) *ClusterValidationFixedEvent { - return &ClusterValidationFixedEvent{ - eventName: ClusterValidationFixedEventName, - ClusterId: clusterId, - ValidationId: validationId, - ValidationMsg: validationMsg, - } + return &ClusterValidationFixedEvent{ + eventName: ClusterValidationFixedEventName, + ClusterId: clusterId, + ValidationId: validationId, + ValidationMsg: validationMsg, + } } func SendClusterValidationFixedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - validationId string, - validationMsg string,) { - ev := NewClusterValidationFixedEvent( - clusterId, - validationId, - validationMsg, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + validationId string, + validationMsg string) { + ev := NewClusterValidationFixedEvent( + clusterId, + validationId, + validationMsg, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterValidationFixedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - validationId string, - validationMsg string, - eventTime time.Time) { - ev := NewClusterValidationFixedEvent( - clusterId, - validationId, - validationMsg, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + validationId string, + validationMsg string, + eventTime time.Time) { + ev := NewClusterValidationFixedEvent( + clusterId, + validationId, + validationMsg, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterValidationFixedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterValidationFixedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterValidationFixedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterValidationFixedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{validation_id}", fmt.Sprint(e.ValidationId), - "{validation_msg}", fmt.Sprint(e.ValidationMsg), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{validation_id}", fmt.Sprint(e.ValidationId), + "{validation_msg}", fmt.Sprint(e.ValidationMsg), + ) + return r.Replace(*message) } func (e *ClusterValidationFixedEvent) FormatMessage() string { - s := "Cluster validation '{validation_id}' is now fixed" - return e.format(&s) + s := "Cluster validation '{validation_id}' is now fixed" + return e.format(&s) } -// // Event after_inactivity_cluster_deregistered -// type AfterInactivityClusterDeregisteredEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var AfterInactivityClusterDeregisteredEventName string = "after_inactivity_cluster_deregistered" func NewAfterInactivityClusterDeregisteredEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *AfterInactivityClusterDeregisteredEvent { - return &AfterInactivityClusterDeregisteredEvent{ - eventName: AfterInactivityClusterDeregisteredEventName, - ClusterId: clusterId, - } + return &AfterInactivityClusterDeregisteredEvent{ + eventName: AfterInactivityClusterDeregisteredEventName, + ClusterId: clusterId, + } } func SendAfterInactivityClusterDeregisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewAfterInactivityClusterDeregisteredEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewAfterInactivityClusterDeregisteredEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendAfterInactivityClusterDeregisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewAfterInactivityClusterDeregisteredEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewAfterInactivityClusterDeregisteredEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *AfterInactivityClusterDeregisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *AfterInactivityClusterDeregisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *AfterInactivityClusterDeregisteredEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *AfterInactivityClusterDeregisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *AfterInactivityClusterDeregisteredEvent) FormatMessage() string { - s := "Cluster is deregistered due to inactivity" - return e.format(&s) + s := "Cluster is deregistered due to inactivity" + return e.format(&s) } -// // Event cluster_installation_completed -// type ClusterInstallationCompletedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterInstallationCompletedEventName string = "cluster_installation_completed" func NewClusterInstallationCompletedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterInstallationCompletedEvent { - return &ClusterInstallationCompletedEvent{ - eventName: ClusterInstallationCompletedEventName, - ClusterId: clusterId, - } + return &ClusterInstallationCompletedEvent{ + eventName: ClusterInstallationCompletedEventName, + ClusterId: clusterId, + } } func SendClusterInstallationCompletedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterInstallationCompletedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterInstallationCompletedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterInstallationCompletedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterInstallationCompletedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterInstallationCompletedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterInstallationCompletedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterInstallationCompletedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterInstallationCompletedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterInstallationCompletedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterInstallationCompletedEvent) FormatMessage() string { - s := "Successfully completed installing cluster" - return e.format(&s) + s := "Successfully completed installing cluster" + return e.format(&s) } -// // Event cluster_installation_failed -// type ClusterInstallationFailedEvent struct { - eventName string - ClusterId strfmt.UUID - FailureReason string + eventName string + ClusterId strfmt.UUID + FailureReason string } var ClusterInstallationFailedEventName string = "cluster_installation_failed" func NewClusterInstallationFailedEvent( - clusterId strfmt.UUID, - failureReason string, + clusterId strfmt.UUID, + failureReason string, ) *ClusterInstallationFailedEvent { - return &ClusterInstallationFailedEvent{ - eventName: ClusterInstallationFailedEventName, - ClusterId: clusterId, - FailureReason: failureReason, - } + return &ClusterInstallationFailedEvent{ + eventName: ClusterInstallationFailedEventName, + ClusterId: clusterId, + FailureReason: failureReason, + } } func SendClusterInstallationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - failureReason string,) { - ev := NewClusterInstallationFailedEvent( - clusterId, - failureReason, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + failureReason string) { + ev := NewClusterInstallationFailedEvent( + clusterId, + failureReason, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterInstallationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - failureReason string, - eventTime time.Time) { - ev := NewClusterInstallationFailedEvent( - clusterId, - failureReason, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + failureReason string, + eventTime time.Time) { + ev := NewClusterInstallationFailedEvent( + clusterId, + failureReason, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterInstallationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterInstallationFailedEvent) GetSeverity() string { - return "critical" + return "critical" } func (e *ClusterInstallationFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterInstallationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{failure_reason}", fmt.Sprint(e.FailureReason), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{failure_reason}", fmt.Sprint(e.FailureReason), + ) + return r.Replace(*message) } func (e *ClusterInstallationFailedEvent) FormatMessage() string { - s := "Failed installing cluster. Reason: {failure_reason}" - return e.format(&s) + s := "Failed installing cluster. Reason: {failure_reason}" + return e.format(&s) } -// // Event cluster_installation_canceled -// type ClusterInstallationCanceledEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterInstallationCanceledEventName string = "cluster_installation_canceled" func NewClusterInstallationCanceledEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterInstallationCanceledEvent { - return &ClusterInstallationCanceledEvent{ - eventName: ClusterInstallationCanceledEventName, - ClusterId: clusterId, - } + return &ClusterInstallationCanceledEvent{ + eventName: ClusterInstallationCanceledEventName, + ClusterId: clusterId, + } } func SendClusterInstallationCanceledEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterInstallationCanceledEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterInstallationCanceledEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterInstallationCanceledEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterInstallationCanceledEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterInstallationCanceledEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterInstallationCanceledEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterInstallationCanceledEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterInstallationCanceledEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterInstallationCanceledEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterInstallationCanceledEvent) FormatMessage() string { - s := "Canceled cluster installation" - return e.format(&s) + s := "Canceled cluster installation" + return e.format(&s) } -// // Event cancel_installation_failed -// type CancelInstallationFailedEvent struct { - eventName string - ClusterId strfmt.UUID - Error string + eventName string + ClusterId strfmt.UUID + Error string } var CancelInstallationFailedEventName string = "cancel_installation_failed" func NewCancelInstallationFailedEvent( - clusterId strfmt.UUID, - error string, + clusterId strfmt.UUID, + error string, ) *CancelInstallationFailedEvent { - return &CancelInstallationFailedEvent{ - eventName: CancelInstallationFailedEventName, - ClusterId: clusterId, - Error: error, - } + return &CancelInstallationFailedEvent{ + eventName: CancelInstallationFailedEventName, + ClusterId: clusterId, + Error: error, + } } func SendCancelInstallationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string,) { - ev := NewCancelInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string) { + ev := NewCancelInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendCancelInstallationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewCancelInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewCancelInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *CancelInstallationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *CancelInstallationFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *CancelInstallationFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *CancelInstallationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *CancelInstallationFailedEvent) FormatMessage() string { - s := "Failed to cancel installation: {error}" - return e.format(&s) + s := "Failed to cancel installation: {error}" + return e.format(&s) } -// // Event cluster_status_updated -// type ClusterStatusUpdatedEvent struct { - eventName string - ClusterId strfmt.UUID - ClusterStatus string - StatusInfo string + eventName string + ClusterId strfmt.UUID + ClusterStatus string + StatusInfo string } var ClusterStatusUpdatedEventName string = "cluster_status_updated" func NewClusterStatusUpdatedEvent( - clusterId strfmt.UUID, - clusterStatus string, - statusInfo string, + clusterId strfmt.UUID, + clusterStatus string, + statusInfo string, ) *ClusterStatusUpdatedEvent { - return &ClusterStatusUpdatedEvent{ - eventName: ClusterStatusUpdatedEventName, - ClusterId: clusterId, - ClusterStatus: clusterStatus, - StatusInfo: statusInfo, - } + return &ClusterStatusUpdatedEvent{ + eventName: ClusterStatusUpdatedEventName, + ClusterId: clusterId, + ClusterStatus: clusterStatus, + StatusInfo: statusInfo, + } } func SendClusterStatusUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - clusterStatus string, - statusInfo string,) { - ev := NewClusterStatusUpdatedEvent( - clusterId, - clusterStatus, - statusInfo, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + clusterStatus string, + statusInfo string) { + ev := NewClusterStatusUpdatedEvent( + clusterId, + clusterStatus, + statusInfo, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterStatusUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - clusterStatus string, - statusInfo string, - eventTime time.Time) { - ev := NewClusterStatusUpdatedEvent( - clusterId, - clusterStatus, - statusInfo, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + clusterStatus string, + statusInfo string, + eventTime time.Time) { + ev := NewClusterStatusUpdatedEvent( + clusterId, + clusterStatus, + statusInfo, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterStatusUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterStatusUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterStatusUpdatedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterStatusUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{cluster_status}", fmt.Sprint(e.ClusterStatus), - "{status_info}", fmt.Sprint(e.StatusInfo), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{cluster_status}", fmt.Sprint(e.ClusterStatus), + "{status_info}", fmt.Sprint(e.StatusInfo), + ) + return r.Replace(*message) } func (e *ClusterStatusUpdatedEvent) FormatMessage() string { - s := "Updated status of the cluster to {cluster_status}" - return e.format(&s) + s := "Updated status of the cluster to {cluster_status}" + return e.format(&s) } -// // Event cluster_finalizing_stage_updated -// type ClusterFinalizingStageUpdatedEvent struct { - eventName string - ClusterId strfmt.UUID - FinalizingStage string + eventName string + ClusterId strfmt.UUID + FinalizingStage string } var ClusterFinalizingStageUpdatedEventName string = "cluster_finalizing_stage_updated" func NewClusterFinalizingStageUpdatedEvent( - clusterId strfmt.UUID, - finalizingStage string, + clusterId strfmt.UUID, + finalizingStage string, ) *ClusterFinalizingStageUpdatedEvent { - return &ClusterFinalizingStageUpdatedEvent{ - eventName: ClusterFinalizingStageUpdatedEventName, - ClusterId: clusterId, - FinalizingStage: finalizingStage, - } + return &ClusterFinalizingStageUpdatedEvent{ + eventName: ClusterFinalizingStageUpdatedEventName, + ClusterId: clusterId, + FinalizingStage: finalizingStage, + } } func SendClusterFinalizingStageUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - finalizingStage string,) { - ev := NewClusterFinalizingStageUpdatedEvent( - clusterId, - finalizingStage, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + finalizingStage string) { + ev := NewClusterFinalizingStageUpdatedEvent( + clusterId, + finalizingStage, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterFinalizingStageUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - finalizingStage string, - eventTime time.Time) { - ev := NewClusterFinalizingStageUpdatedEvent( - clusterId, - finalizingStage, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + finalizingStage string, + eventTime time.Time) { + ev := NewClusterFinalizingStageUpdatedEvent( + clusterId, + finalizingStage, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterFinalizingStageUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterFinalizingStageUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterFinalizingStageUpdatedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterFinalizingStageUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{finalizing_stage}", fmt.Sprint(e.FinalizingStage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{finalizing_stage}", fmt.Sprint(e.FinalizingStage), + ) + return r.Replace(*message) } func (e *ClusterFinalizingStageUpdatedEvent) FormatMessage() string { - s := "Updated finalizing stage of the cluster to '{finalizing_stage}'" - return e.format(&s) + s := "Updated finalizing stage of the cluster to '{finalizing_stage}'" + return e.format(&s) } -// // Event cluster_installation_reset -// type ClusterInstallationResetEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterInstallationResetEventName string = "cluster_installation_reset" func NewClusterInstallationResetEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterInstallationResetEvent { - return &ClusterInstallationResetEvent{ - eventName: ClusterInstallationResetEventName, - ClusterId: clusterId, - } + return &ClusterInstallationResetEvent{ + eventName: ClusterInstallationResetEventName, + ClusterId: clusterId, + } } func SendClusterInstallationResetEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterInstallationResetEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterInstallationResetEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterInstallationResetEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterInstallationResetEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterInstallationResetEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterInstallationResetEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterInstallationResetEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterInstallationResetEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterInstallationResetEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterInstallationResetEvent) FormatMessage() string { - s := "Reset cluster installation" - return e.format(&s) + s := "Reset cluster installation" + return e.format(&s) } -// // Event reset_installation_failed -// type ResetInstallationFailedEvent struct { - eventName string - ClusterId strfmt.UUID - Error string + eventName string + ClusterId strfmt.UUID + Error string } var ResetInstallationFailedEventName string = "reset_installation_failed" func NewResetInstallationFailedEvent( - clusterId strfmt.UUID, - error string, + clusterId strfmt.UUID, + error string, ) *ResetInstallationFailedEvent { - return &ResetInstallationFailedEvent{ - eventName: ResetInstallationFailedEventName, - ClusterId: clusterId, - Error: error, - } + return &ResetInstallationFailedEvent{ + eventName: ResetInstallationFailedEventName, + ClusterId: clusterId, + Error: error, + } } func SendResetInstallationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string,) { - ev := NewResetInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string) { + ev := NewResetInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendResetInstallationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewResetInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewResetInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ResetInstallationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ResetInstallationFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *ResetInstallationFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ResetInstallationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *ResetInstallationFailedEvent) FormatMessage() string { - s := "Failed to reset installation. Error: {error}" - return e.format(&s) + s := "Failed to reset installation. Error: {error}" + return e.format(&s) } -// // Event api_ingress_vip_updated -// type ApiIngressVipUpdatedEvent struct { - eventName string - ClusterId strfmt.UUID - ApiVip string - IngressVip string + eventName string + ClusterId strfmt.UUID + ApiVip string + IngressVip string } var ApiIngressVipUpdatedEventName string = "api_ingress_vip_updated" func NewApiIngressVipUpdatedEvent( - clusterId strfmt.UUID, - apiVip string, - ingressVip string, + clusterId strfmt.UUID, + apiVip string, + ingressVip string, ) *ApiIngressVipUpdatedEvent { - return &ApiIngressVipUpdatedEvent{ - eventName: ApiIngressVipUpdatedEventName, - ClusterId: clusterId, - ApiVip: apiVip, - IngressVip: ingressVip, - } + return &ApiIngressVipUpdatedEvent{ + eventName: ApiIngressVipUpdatedEventName, + ClusterId: clusterId, + ApiVip: apiVip, + IngressVip: ingressVip, + } } func SendApiIngressVipUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - apiVip string, - ingressVip string,) { - ev := NewApiIngressVipUpdatedEvent( - clusterId, - apiVip, - ingressVip, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + apiVip string, + ingressVip string) { + ev := NewApiIngressVipUpdatedEvent( + clusterId, + apiVip, + ingressVip, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendApiIngressVipUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - apiVip string, - ingressVip string, - eventTime time.Time) { - ev := NewApiIngressVipUpdatedEvent( - clusterId, - apiVip, - ingressVip, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + apiVip string, + ingressVip string, + eventTime time.Time) { + ev := NewApiIngressVipUpdatedEvent( + clusterId, + apiVip, + ingressVip, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ApiIngressVipUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ApiIngressVipUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ApiIngressVipUpdatedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ApiIngressVipUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{api_vip}", fmt.Sprint(e.ApiVip), - "{ingress_vip}", fmt.Sprint(e.IngressVip), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{api_vip}", fmt.Sprint(e.ApiVip), + "{ingress_vip}", fmt.Sprint(e.IngressVip), + ) + return r.Replace(*message) } func (e *ApiIngressVipUpdatedEvent) FormatMessage() string { - s := "Cluster was updated with api-vip {api_vip}, ingress-vip {ingress_vip}" - return e.format(&s) + s := "Cluster was updated with api-vip {api_vip}, ingress-vip {ingress_vip}" + return e.format(&s) } -// // Event api_ingress_vip_timed_out -// type ApiIngressVipTimedOutEvent struct { - eventName string - ClusterId strfmt.UUID - TimeoutInterval int + eventName string + ClusterId strfmt.UUID + TimeoutInterval int } var ApiIngressVipTimedOutEventName string = "api_ingress_vip_timed_out" func NewApiIngressVipTimedOutEvent( - clusterId strfmt.UUID, - timeoutInterval int, + clusterId strfmt.UUID, + timeoutInterval int, ) *ApiIngressVipTimedOutEvent { - return &ApiIngressVipTimedOutEvent{ - eventName: ApiIngressVipTimedOutEventName, - ClusterId: clusterId, - TimeoutInterval: timeoutInterval, - } + return &ApiIngressVipTimedOutEvent{ + eventName: ApiIngressVipTimedOutEventName, + ClusterId: clusterId, + TimeoutInterval: timeoutInterval, + } } func SendApiIngressVipTimedOutEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - timeoutInterval int,) { - ev := NewApiIngressVipTimedOutEvent( - clusterId, - timeoutInterval, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + timeoutInterval int) { + ev := NewApiIngressVipTimedOutEvent( + clusterId, + timeoutInterval, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendApiIngressVipTimedOutEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - timeoutInterval int, - eventTime time.Time) { - ev := NewApiIngressVipTimedOutEvent( - clusterId, - timeoutInterval, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + timeoutInterval int, + eventTime time.Time) { + ev := NewApiIngressVipTimedOutEvent( + clusterId, + timeoutInterval, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ApiIngressVipTimedOutEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ApiIngressVipTimedOutEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *ApiIngressVipTimedOutEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ApiIngressVipTimedOutEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{timeout_interval}", fmt.Sprint(e.TimeoutInterval), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{timeout_interval}", fmt.Sprint(e.TimeoutInterval), + ) + return r.Replace(*message) } func (e *ApiIngressVipTimedOutEvent) FormatMessage() string { - s := "API and Ingress VIPs lease allocation has been timed out" - return e.format(&s) + s := "API and Ingress VIPs lease allocation has been timed out" + return e.format(&s) } -// // Event prepare_installation_failed -// type PrepareInstallationFailedEvent struct { - eventName string - ClusterId strfmt.UUID - Error string + eventName string + ClusterId strfmt.UUID + Error string } var PrepareInstallationFailedEventName string = "prepare_installation_failed" func NewPrepareInstallationFailedEvent( - clusterId strfmt.UUID, - error string, + clusterId strfmt.UUID, + error string, ) *PrepareInstallationFailedEvent { - return &PrepareInstallationFailedEvent{ - eventName: PrepareInstallationFailedEventName, - ClusterId: clusterId, - Error: error, - } + return &PrepareInstallationFailedEvent{ + eventName: PrepareInstallationFailedEventName, + ClusterId: clusterId, + Error: error, + } } func SendPrepareInstallationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string,) { - ev := NewPrepareInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string) { + ev := NewPrepareInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendPrepareInstallationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewPrepareInstallationFailedEvent( - clusterId, - error, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewPrepareInstallationFailedEvent( + clusterId, + error, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *PrepareInstallationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *PrepareInstallationFailedEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *PrepareInstallationFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *PrepareInstallationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *PrepareInstallationFailedEvent) FormatMessage() string { - s := "Failed to prepare the installation due to an unexpected error: {error}. Please retry later" - return e.format(&s) + s := "Failed to prepare the installation due to an unexpected error: {error}. Please retry later" + return e.format(&s) } -// // Event cluster_prepare_installation_started -// type ClusterPrepareInstallationStartedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterPrepareInstallationStartedEventName string = "cluster_prepare_installation_started" func NewClusterPrepareInstallationStartedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterPrepareInstallationStartedEvent { - return &ClusterPrepareInstallationStartedEvent{ - eventName: ClusterPrepareInstallationStartedEventName, - ClusterId: clusterId, - } + return &ClusterPrepareInstallationStartedEvent{ + eventName: ClusterPrepareInstallationStartedEventName, + ClusterId: clusterId, + } } func SendClusterPrepareInstallationStartedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterPrepareInstallationStartedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterPrepareInstallationStartedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterPrepareInstallationStartedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterPrepareInstallationStartedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterPrepareInstallationStartedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterPrepareInstallationStartedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterPrepareInstallationStartedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterPrepareInstallationStartedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterPrepareInstallationStartedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterPrepareInstallationStartedEvent) FormatMessage() string { - s := "Cluster starting to prepare for installation" - return e.format(&s) + s := "Cluster starting to prepare for installation" + return e.format(&s) } -// // Event installation_preparing_timed_out -// type InstallationPreparingTimedOutEvent struct { - eventName string - ClusterId strfmt.UUID - Reason string + eventName string + ClusterId strfmt.UUID + Reason string } var InstallationPreparingTimedOutEventName string = "installation_preparing_timed_out" func NewInstallationPreparingTimedOutEvent( - clusterId strfmt.UUID, - reason string, + clusterId strfmt.UUID, + reason string, ) *InstallationPreparingTimedOutEvent { - return &InstallationPreparingTimedOutEvent{ - eventName: InstallationPreparingTimedOutEventName, - ClusterId: clusterId, - Reason: reason, - } + return &InstallationPreparingTimedOutEvent{ + eventName: InstallationPreparingTimedOutEventName, + ClusterId: clusterId, + Reason: reason, + } } func SendInstallationPreparingTimedOutEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - reason string,) { - ev := NewInstallationPreparingTimedOutEvent( - clusterId, - reason, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + reason string) { + ev := NewInstallationPreparingTimedOutEvent( + clusterId, + reason, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendInstallationPreparingTimedOutEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - reason string, - eventTime time.Time) { - ev := NewInstallationPreparingTimedOutEvent( - clusterId, - reason, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + reason string, + eventTime time.Time) { + ev := NewInstallationPreparingTimedOutEvent( + clusterId, + reason, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *InstallationPreparingTimedOutEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InstallationPreparingTimedOutEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *InstallationPreparingTimedOutEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *InstallationPreparingTimedOutEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{reason}", fmt.Sprint(e.Reason), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{reason}", fmt.Sprint(e.Reason), + ) + return r.Replace(*message) } func (e *InstallationPreparingTimedOutEvent) FormatMessage() string { - s := "Preparing for installation was timed out for the cluster, reason {reason}" - return e.format(&s) + s := "Preparing for installation was timed out for the cluster, reason {reason}" + return e.format(&s) } -// // Event cluster_degraded_OLM_operators_failed -// type ClusterDegradedOLMOperatorsFailedEvent struct { - eventName string - ClusterId strfmt.UUID - FailedOperators string + eventName string + ClusterId strfmt.UUID + FailedOperators string } var ClusterDegradedOLMOperatorsFailedEventName string = "cluster_degraded_OLM_operators_failed" func NewClusterDegradedOLMOperatorsFailedEvent( - clusterId strfmt.UUID, - failedOperators string, + clusterId strfmt.UUID, + failedOperators string, ) *ClusterDegradedOLMOperatorsFailedEvent { - return &ClusterDegradedOLMOperatorsFailedEvent{ - eventName: ClusterDegradedOLMOperatorsFailedEventName, - ClusterId: clusterId, - FailedOperators: failedOperators, - } + return &ClusterDegradedOLMOperatorsFailedEvent{ + eventName: ClusterDegradedOLMOperatorsFailedEventName, + ClusterId: clusterId, + FailedOperators: failedOperators, + } } func SendClusterDegradedOLMOperatorsFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - failedOperators string,) { - ev := NewClusterDegradedOLMOperatorsFailedEvent( - clusterId, - failedOperators, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + failedOperators string) { + ev := NewClusterDegradedOLMOperatorsFailedEvent( + clusterId, + failedOperators, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterDegradedOLMOperatorsFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - failedOperators string, - eventTime time.Time) { - ev := NewClusterDegradedOLMOperatorsFailedEvent( - clusterId, - failedOperators, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + failedOperators string, + eventTime time.Time) { + ev := NewClusterDegradedOLMOperatorsFailedEvent( + clusterId, + failedOperators, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterDegradedOLMOperatorsFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterDegradedOLMOperatorsFailedEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *ClusterDegradedOLMOperatorsFailedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterDegradedOLMOperatorsFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{failed_operators}", fmt.Sprint(e.FailedOperators), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{failed_operators}", fmt.Sprint(e.FailedOperators), + ) + return r.Replace(*message) } func (e *ClusterDegradedOLMOperatorsFailedEvent) FormatMessage() string { - s := "Cluster is installed but degraded due to failed OLM operators {failed_operators}" - return e.format(&s) + s := "Cluster is installed but degraded due to failed OLM operators {failed_operators}" + return e.format(&s) } -// // Event expired_image_deleted -// type ExpiredImageDeletedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ExpiredImageDeletedEventName string = "expired_image_deleted" func NewExpiredImageDeletedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ExpiredImageDeletedEvent { - return &ExpiredImageDeletedEvent{ - eventName: ExpiredImageDeletedEventName, - ClusterId: clusterId, - } + return &ExpiredImageDeletedEvent{ + eventName: ExpiredImageDeletedEventName, + ClusterId: clusterId, + } } func SendExpiredImageDeletedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewExpiredImageDeletedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewExpiredImageDeletedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendExpiredImageDeletedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewExpiredImageDeletedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewExpiredImageDeletedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ExpiredImageDeletedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ExpiredImageDeletedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ExpiredImageDeletedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ExpiredImageDeletedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ExpiredImageDeletedEvent) FormatMessage() string { - s := "Deleted image from backend because it expired. It may be generated again at any time" - return e.format(&s) + s := "Deleted image from backend because it expired. It may be generated again at any time" + return e.format(&s) } -// // Event cluster_operator_report -// type ClusterOperatorReportEvent struct { - eventName string - ClusterId strfmt.UUID - Report string + eventName string + ClusterId strfmt.UUID + Report string } var ClusterOperatorReportEventName string = "cluster_operator_report" func NewClusterOperatorReportEvent( - clusterId strfmt.UUID, - report string, + clusterId strfmt.UUID, + report string, ) *ClusterOperatorReportEvent { - return &ClusterOperatorReportEvent{ - eventName: ClusterOperatorReportEventName, - ClusterId: clusterId, - Report: report, - } + return &ClusterOperatorReportEvent{ + eventName: ClusterOperatorReportEventName, + ClusterId: clusterId, + Report: report, + } } func SendClusterOperatorReportEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - report string,) { - ev := NewClusterOperatorReportEvent( - clusterId, - report, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + report string) { + ev := NewClusterOperatorReportEvent( + clusterId, + report, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterOperatorReportEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - report string, - eventTime time.Time) { - ev := NewClusterOperatorReportEvent( - clusterId, - report, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + report string, + eventTime time.Time) { + ev := NewClusterOperatorReportEvent( + clusterId, + report, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterOperatorReportEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterOperatorReportEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterOperatorReportEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterOperatorReportEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{report}", fmt.Sprint(e.Report), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{report}", fmt.Sprint(e.Report), + ) + return r.Replace(*message) } func (e *ClusterOperatorReportEvent) FormatMessage() string { - s := "The following operators are experiencing issues: {report}" - return e.format(&s) + s := "The following operators are experiencing issues: {report}" + return e.format(&s) } -// // Event cluster_operator_status -// type ClusterOperatorStatusEvent struct { - eventName string - ClusterId strfmt.UUID - OperatorName string - Status string - StatusInfo string + eventName string + ClusterId strfmt.UUID + OperatorName string + Status string + StatusInfo string } var ClusterOperatorStatusEventName string = "cluster_operator_status" func NewClusterOperatorStatusEvent( - clusterId strfmt.UUID, - operatorName string, - status string, - statusInfo string, + clusterId strfmt.UUID, + operatorName string, + status string, + statusInfo string, ) *ClusterOperatorStatusEvent { - return &ClusterOperatorStatusEvent{ - eventName: ClusterOperatorStatusEventName, - ClusterId: clusterId, - OperatorName: operatorName, - Status: status, - StatusInfo: statusInfo, - } + return &ClusterOperatorStatusEvent{ + eventName: ClusterOperatorStatusEventName, + ClusterId: clusterId, + OperatorName: operatorName, + Status: status, + StatusInfo: statusInfo, + } } func SendClusterOperatorStatusEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - operatorName string, - status string, - statusInfo string,) { - ev := NewClusterOperatorStatusEvent( - clusterId, - operatorName, - status, - statusInfo, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + operatorName string, + status string, + statusInfo string) { + ev := NewClusterOperatorStatusEvent( + clusterId, + operatorName, + status, + statusInfo, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterOperatorStatusEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - operatorName string, - status string, - statusInfo string, - eventTime time.Time) { - ev := NewClusterOperatorStatusEvent( - clusterId, - operatorName, - status, - statusInfo, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + operatorName string, + status string, + statusInfo string, + eventTime time.Time) { + ev := NewClusterOperatorStatusEvent( + clusterId, + operatorName, + status, + statusInfo, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterOperatorStatusEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterOperatorStatusEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterOperatorStatusEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterOperatorStatusEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{operator_name}", fmt.Sprint(e.OperatorName), - "{status}", fmt.Sprint(e.Status), - "{status_info}", fmt.Sprint(e.StatusInfo), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{operator_name}", fmt.Sprint(e.OperatorName), + "{status}", fmt.Sprint(e.Status), + "{status_info}", fmt.Sprint(e.StatusInfo), + ) + return r.Replace(*message) } func (e *ClusterOperatorStatusEvent) FormatMessage() string { - s := "Operator {operator_name} status: {status} message: {status_info}" - return e.format(&s) + s := "Operator {operator_name} status: {status} message: {status_info}" + return e.format(&s) } -// // Event finalizing_stage_timed_out -// type FinalizingStageTimedOutEvent struct { - eventName string - ClusterId strfmt.UUID - Stage string - Minutes int64 + eventName string + ClusterId strfmt.UUID + Stage string + Minutes int64 } var FinalizingStageTimedOutEventName string = "finalizing_stage_timed_out" func NewFinalizingStageTimedOutEvent( - clusterId strfmt.UUID, - stage string, - minutes int64, + clusterId strfmt.UUID, + stage string, + minutes int64, ) *FinalizingStageTimedOutEvent { - return &FinalizingStageTimedOutEvent{ - eventName: FinalizingStageTimedOutEventName, - ClusterId: clusterId, - Stage: stage, - Minutes: minutes, - } + return &FinalizingStageTimedOutEvent{ + eventName: FinalizingStageTimedOutEventName, + ClusterId: clusterId, + Stage: stage, + Minutes: minutes, + } } func SendFinalizingStageTimedOutEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - stage string, - minutes int64,) { - ev := NewFinalizingStageTimedOutEvent( - clusterId, - stage, - minutes, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + stage string, + minutes int64) { + ev := NewFinalizingStageTimedOutEvent( + clusterId, + stage, + minutes, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendFinalizingStageTimedOutEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - stage string, - minutes int64, - eventTime time.Time) { - ev := NewFinalizingStageTimedOutEvent( - clusterId, - stage, - minutes, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + stage string, + minutes int64, + eventTime time.Time) { + ev := NewFinalizingStageTimedOutEvent( + clusterId, + stage, + minutes, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *FinalizingStageTimedOutEvent) GetName() string { - return e.eventName + return e.eventName } func (e *FinalizingStageTimedOutEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *FinalizingStageTimedOutEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *FinalizingStageTimedOutEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{stage}", fmt.Sprint(e.Stage), - "{minutes}", fmt.Sprint(e.Minutes), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{stage}", fmt.Sprint(e.Stage), + "{minutes}", fmt.Sprint(e.Minutes), + ) + return r.Replace(*message) } func (e *FinalizingStageTimedOutEvent) FormatMessage() string { - s := "Cluster {cluster_id}: finalizing stage {stage} has been active more than the expected completion time ({minutes} minutes)" - return e.format(&s) + s := "Cluster {cluster_id}: finalizing stage {stage} has been active more than the expected completion time ({minutes} minutes)" + return e.format(&s) } -// // Event host_deregistered -// type HostDeregisteredEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostDeregisteredEventName string = "host_deregistered" func NewHostDeregisteredEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostDeregisteredEvent { - return &HostDeregisteredEvent{ - eventName: HostDeregisteredEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostDeregisteredEvent{ + eventName: HostDeregisteredEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostDeregisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostDeregisteredEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostDeregisteredEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostDeregisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostDeregisteredEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostDeregisteredEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostDeregisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostDeregisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostDeregisteredEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostDeregisteredEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostDeregisteredEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostDeregisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostDeregisteredEvent) FormatMessage() string { - s := "Host {host_name} deregistered" - return e.format(&s) + s := "Host {host_name} deregistered" + return e.format(&s) } -// // Event host_installer_args_applied -// type HostInstallerArgsAppliedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostInstallerArgsAppliedEventName string = "host_installer_args_applied" func NewHostInstallerArgsAppliedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostInstallerArgsAppliedEvent { - return &HostInstallerArgsAppliedEvent{ - eventName: HostInstallerArgsAppliedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostInstallerArgsAppliedEvent{ + eventName: HostInstallerArgsAppliedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostInstallerArgsAppliedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostInstallerArgsAppliedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostInstallerArgsAppliedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallerArgsAppliedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostInstallerArgsAppliedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostInstallerArgsAppliedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallerArgsAppliedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallerArgsAppliedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostInstallerArgsAppliedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallerArgsAppliedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallerArgsAppliedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallerArgsAppliedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostInstallerArgsAppliedEvent) FormatMessage() string { - s := "Host {host_name}: custom installer arguments were applied" - return e.format(&s) + s := "Host {host_name}: custom installer arguments were applied" + return e.format(&s) } -// // Event host_bootstrap_set -// type HostBootstrapSetEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostBootstrapSetEventName string = "host_bootstrap_set" func NewHostBootstrapSetEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostBootstrapSetEvent { - return &HostBootstrapSetEvent{ - eventName: HostBootstrapSetEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostBootstrapSetEvent{ + eventName: HostBootstrapSetEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostBootstrapSetEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostBootstrapSetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostBootstrapSetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostBootstrapSetEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostBootstrapSetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostBootstrapSetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostBootstrapSetEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostBootstrapSetEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostBootstrapSetEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostBootstrapSetEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostBootstrapSetEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostBootstrapSetEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostBootstrapSetEvent) FormatMessage() string { - s := "Host {host_name}: set as bootstrap" - return e.format(&s) + s := "Host {host_name}: set as bootstrap" + return e.format(&s) } -// // Event host_status_updated -// type HostStatusUpdatedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - Severity string - HostName string - SrcStatus string - NewStatus string - Info string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + Severity string + HostName string + SrcStatus string + NewStatus string + Info string } var HostStatusUpdatedEventName string = "host_status_updated" func NewHostStatusUpdatedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - severity string, - hostName string, - srcStatus string, - newStatus string, - info string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + severity string, + hostName string, + srcStatus string, + newStatus string, + info string, ) *HostStatusUpdatedEvent { - return &HostStatusUpdatedEvent{ - eventName: HostStatusUpdatedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - Severity: severity, - HostName: hostName, - SrcStatus: srcStatus, - NewStatus: newStatus, - Info: info, - } + return &HostStatusUpdatedEvent{ + eventName: HostStatusUpdatedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + Severity: severity, + HostName: hostName, + SrcStatus: srcStatus, + NewStatus: newStatus, + Info: info, + } } func SendHostStatusUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - severity string, - hostName string, - srcStatus string, - newStatus string, - info string,) { - ev := NewHostStatusUpdatedEvent( - hostId, - infraEnvId, - clusterId, - severity, - hostName, - srcStatus, - newStatus, - info, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + severity string, + hostName string, + srcStatus string, + newStatus string, + info string) { + ev := NewHostStatusUpdatedEvent( + hostId, + infraEnvId, + clusterId, + severity, + hostName, + srcStatus, + newStatus, + info, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostStatusUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - severity string, - hostName string, - srcStatus string, - newStatus string, - info string, - eventTime time.Time) { - ev := NewHostStatusUpdatedEvent( - hostId, - infraEnvId, - clusterId, - severity, - hostName, - srcStatus, - newStatus, - info, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + severity string, + hostName string, + srcStatus string, + newStatus string, + info string, + eventTime time.Time) { + ev := NewHostStatusUpdatedEvent( + hostId, + infraEnvId, + clusterId, + severity, + hostName, + srcStatus, + newStatus, + info, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostStatusUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostStatusUpdatedEvent) GetSeverity() string { - return e.Severity + return e.Severity } func (e *HostStatusUpdatedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostStatusUpdatedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostStatusUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } func (e *HostStatusUpdatedEvent) GetInfo() string { - return e.Info + return e.Info } func (e *HostStatusUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{severity}", fmt.Sprint(e.Severity), - "{host_name}", fmt.Sprint(e.HostName), - "{src_status}", fmt.Sprint(e.SrcStatus), - "{new_status}", fmt.Sprint(e.NewStatus), - "{info}", fmt.Sprint(e.Info), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{severity}", fmt.Sprint(e.Severity), + "{host_name}", fmt.Sprint(e.HostName), + "{src_status}", fmt.Sprint(e.SrcStatus), + "{new_status}", fmt.Sprint(e.NewStatus), + "{info}", fmt.Sprint(e.Info), + ) + return r.Replace(*message) } func (e *HostStatusUpdatedEvent) FormatMessage() string { - s := "Host {host_name}: updated status from {src_status} to {new_status} {info}" - return e.format(&s) + s := "Host {host_name}: updated status from {src_status} to {new_status} {info}" + return e.format(&s) } -// // Event host_stage_timed_out -// type HostStageTimedOutEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - Stage string - Minutes int64 + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + Stage string + Minutes int64 } var HostStageTimedOutEventName string = "host_stage_timed_out" func NewHostStageTimedOutEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - stage string, - minutes int64, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + stage string, + minutes int64, ) *HostStageTimedOutEvent { - return &HostStageTimedOutEvent{ - eventName: HostStageTimedOutEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - Stage: stage, - Minutes: minutes, - } + return &HostStageTimedOutEvent{ + eventName: HostStageTimedOutEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + Stage: stage, + Minutes: minutes, + } } func SendHostStageTimedOutEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - stage string, - minutes int64,) { - ev := NewHostStageTimedOutEvent( - hostId, - infraEnvId, - clusterId, - hostName, - stage, - minutes, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + stage string, + minutes int64) { + ev := NewHostStageTimedOutEvent( + hostId, + infraEnvId, + clusterId, + hostName, + stage, + minutes, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostStageTimedOutEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - stage string, - minutes int64, - eventTime time.Time) { - ev := NewHostStageTimedOutEvent( - hostId, - infraEnvId, - clusterId, - hostName, - stage, - minutes, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + stage string, + minutes int64, + eventTime time.Time) { + ev := NewHostStageTimedOutEvent( + hostId, + infraEnvId, + clusterId, + hostName, + stage, + minutes, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostStageTimedOutEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostStageTimedOutEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *HostStageTimedOutEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostStageTimedOutEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostStageTimedOutEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostStageTimedOutEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{stage}", fmt.Sprint(e.Stage), - "{minutes}", fmt.Sprint(e.Minutes), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{stage}", fmt.Sprint(e.Stage), + "{minutes}", fmt.Sprint(e.Minutes), + ) + return r.Replace(*message) } func (e *HostStageTimedOutEvent) FormatMessage() string { - s := "Host {host_name}: host stage {stage} has been active more than the expected completion time ({minutes} minutes)" - return e.format(&s) + s := "Host {host_name}: host stage {stage} has been active more than the expected completion time ({minutes} minutes)" + return e.format(&s) } -// // Event host_role_updated -// type HostRoleUpdatedEvent struct { - eventName string - ClusterId *strfmt.UUID - HostId strfmt.UUID - InfraEnvId strfmt.UUID - HostName string - SuggestedRole string + eventName string + ClusterId *strfmt.UUID + HostId strfmt.UUID + InfraEnvId strfmt.UUID + HostName string + SuggestedRole string } var HostRoleUpdatedEventName string = "host_role_updated" func NewHostRoleUpdatedEvent( - clusterId *strfmt.UUID, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - suggestedRole string, + clusterId *strfmt.UUID, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + suggestedRole string, ) *HostRoleUpdatedEvent { - return &HostRoleUpdatedEvent{ - eventName: HostRoleUpdatedEventName, - ClusterId: clusterId, - HostId: hostId, - InfraEnvId: infraEnvId, - HostName: hostName, - SuggestedRole: suggestedRole, - } + return &HostRoleUpdatedEvent{ + eventName: HostRoleUpdatedEventName, + ClusterId: clusterId, + HostId: hostId, + InfraEnvId: infraEnvId, + HostName: hostName, + SuggestedRole: suggestedRole, + } } func SendHostRoleUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId *strfmt.UUID, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - suggestedRole string,) { - ev := NewHostRoleUpdatedEvent( - clusterId, - hostId, - infraEnvId, - hostName, - suggestedRole, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId *strfmt.UUID, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + suggestedRole string) { + ev := NewHostRoleUpdatedEvent( + clusterId, + hostId, + infraEnvId, + hostName, + suggestedRole, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostRoleUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId *strfmt.UUID, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - suggestedRole string, - eventTime time.Time) { - ev := NewHostRoleUpdatedEvent( - clusterId, - hostId, - infraEnvId, - hostName, - suggestedRole, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId *strfmt.UUID, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + suggestedRole string, + eventTime time.Time) { + ev := NewHostRoleUpdatedEvent( + clusterId, + hostId, + infraEnvId, + hostName, + suggestedRole, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostRoleUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostRoleUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostRoleUpdatedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostRoleUpdatedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostRoleUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostRoleUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{host_name}", fmt.Sprint(e.HostName), - "{suggested_role}", fmt.Sprint(e.SuggestedRole), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{host_name}", fmt.Sprint(e.HostName), + "{suggested_role}", fmt.Sprint(e.SuggestedRole), + ) + return r.Replace(*message) } func (e *HostRoleUpdatedEvent) FormatMessage() string { - s := "Host {host_name}: calculated role is {suggested_role}" - return e.format(&s) + s := "Host {host_name}: calculated role is {suggested_role}" + return e.format(&s) } -// // Event image_status_updated -// type ImageStatusUpdatedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - ImageStatus string - Result string - Info string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + ImageStatus string + Result string + Info string } var ImageStatusUpdatedEventName string = "image_status_updated" func NewImageStatusUpdatedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - imageStatus string, - result string, - info string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + imageStatus string, + result string, + info string, ) *ImageStatusUpdatedEvent { - return &ImageStatusUpdatedEvent{ - eventName: ImageStatusUpdatedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - ImageStatus: imageStatus, - Result: result, - Info: info, - } + return &ImageStatusUpdatedEvent{ + eventName: ImageStatusUpdatedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + ImageStatus: imageStatus, + Result: result, + Info: info, + } } func SendImageStatusUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - imageStatus string, - result string, - info string,) { - ev := NewImageStatusUpdatedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - imageStatus, - result, - info, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + imageStatus string, + result string, + info string) { + ev := NewImageStatusUpdatedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + imageStatus, + result, + info, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendImageStatusUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - imageStatus string, - result string, - info string, - eventTime time.Time) { - ev := NewImageStatusUpdatedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - imageStatus, - result, - info, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + imageStatus string, + result string, + info string, + eventTime time.Time) { + ev := NewImageStatusUpdatedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + imageStatus, + result, + info, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *ImageStatusUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ImageStatusUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ImageStatusUpdatedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *ImageStatusUpdatedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *ImageStatusUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } func (e *ImageStatusUpdatedEvent) GetInfo() string { - return e.Info + return e.Info } func (e *ImageStatusUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{image_status}", fmt.Sprint(e.ImageStatus), - "{result}", fmt.Sprint(e.Result), - "{info}", fmt.Sprint(e.Info), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{image_status}", fmt.Sprint(e.ImageStatus), + "{result}", fmt.Sprint(e.Result), + "{info}", fmt.Sprint(e.Info), + ) + return r.Replace(*message) } func (e *ImageStatusUpdatedEvent) FormatMessage() string { - s := "Host {host_name}: New image status {image_status}. result: {result}. {info}" - return e.format(&s) + s := "Host {host_name}: New image status {image_status}. result: {result}. {info}" + return e.format(&s) } -// // Event host_installation_cancelled -// type HostInstallationCancelledEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostInstallationCancelledEventName string = "host_installation_cancelled" func NewHostInstallationCancelledEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostInstallationCancelledEvent { - return &HostInstallationCancelledEvent{ - eventName: HostInstallationCancelledEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostInstallationCancelledEvent{ + eventName: HostInstallationCancelledEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostInstallationCancelledEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostInstallationCancelledEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostInstallationCancelledEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallationCancelledEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostInstallationCancelledEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostInstallationCancelledEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallationCancelledEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallationCancelledEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostInstallationCancelledEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallationCancelledEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallationCancelledEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallationCancelledEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostInstallationCancelledEvent) FormatMessage() string { - s := "Installation cancelled for host {host_name}" - return e.format(&s) + s := "Installation cancelled for host {host_name}" + return e.format(&s) } -// // Event host_installation_started -// type HostInstallationStartedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostInstallationStartedEventName string = "host_installation_started" func NewHostInstallationStartedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostInstallationStartedEvent { - return &HostInstallationStartedEvent{ - eventName: HostInstallationStartedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostInstallationStartedEvent{ + eventName: HostInstallationStartedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostInstallationStartedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostInstallationStartedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostInstallationStartedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallationStartedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostInstallationStartedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostInstallationStartedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallationStartedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallationStartedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostInstallationStartedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallationStartedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallationStartedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallationStartedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostInstallationStartedEvent) FormatMessage() string { - s := "Host {host_name} starting installation as a worker node" - return e.format(&s) + s := "Host {host_name} starting installation as a worker node" + return e.format(&s) } -// // Event host_cancel_installation_failed -// type HostCancelInstallationFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - Error string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + Error string } var HostCancelInstallationFailedEventName string = "host_cancel_installation_failed" func NewHostCancelInstallationFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, ) *HostCancelInstallationFailedEvent { - return &HostCancelInstallationFailedEvent{ - eventName: HostCancelInstallationFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - Error: error, - } + return &HostCancelInstallationFailedEvent{ + eventName: HostCancelInstallationFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + Error: error, + } } func SendHostCancelInstallationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string,) { - ev := NewHostCancelInstallationFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string) { + ev := NewHostCancelInstallationFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostCancelInstallationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, - eventTime time.Time) { - ev := NewHostCancelInstallationFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, + eventTime time.Time) { + ev := NewHostCancelInstallationFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostCancelInstallationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostCancelInstallationFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostCancelInstallationFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostCancelInstallationFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostCancelInstallationFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostCancelInstallationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *HostCancelInstallationFailedEvent) FormatMessage() string { - s := "Failed to cancel installation of host {host_name}: {error}" - return e.format(&s) + s := "Failed to cancel installation of host {host_name}: {error}" + return e.format(&s) } -// // Event host_installation_reset -// type HostInstallationResetEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostInstallationResetEventName string = "host_installation_reset" func NewHostInstallationResetEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostInstallationResetEvent { - return &HostInstallationResetEvent{ - eventName: HostInstallationResetEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostInstallationResetEvent{ + eventName: HostInstallationResetEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostInstallationResetEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostInstallationResetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostInstallationResetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallationResetEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostInstallationResetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostInstallationResetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallationResetEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallationResetEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostInstallationResetEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallationResetEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallationResetEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallationResetEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostInstallationResetEvent) FormatMessage() string { - s := "Installation reset for host {host_name}" - return e.format(&s) + s := "Installation reset for host {host_name}" + return e.format(&s) } -// // Event host_installation_reset_failed -// type HostInstallationResetFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - Error string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + Error string } var HostInstallationResetFailedEventName string = "host_installation_reset_failed" func NewHostInstallationResetFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, ) *HostInstallationResetFailedEvent { - return &HostInstallationResetFailedEvent{ - eventName: HostInstallationResetFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - Error: error, - } + return &HostInstallationResetFailedEvent{ + eventName: HostInstallationResetFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + Error: error, + } } func SendHostInstallationResetFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string,) { - ev := NewHostInstallationResetFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string) { + ev := NewHostInstallationResetFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallationResetFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, - eventTime time.Time) { - ev := NewHostInstallationResetFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, + eventTime time.Time) { + ev := NewHostInstallationResetFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallationResetFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallationResetFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostInstallationResetFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallationResetFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallationResetFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallationResetFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *HostInstallationResetFailedEvent) FormatMessage() string { - s := "Failed to reset installation of host {host_name}. Error: {error}" - return e.format(&s) + s := "Failed to reset installation of host {host_name}. Error: {error}" + return e.format(&s) } -// // Event user_required_complete_installation_reset -// type UserRequiredCompleteInstallationResetEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var UserRequiredCompleteInstallationResetEventName string = "user_required_complete_installation_reset" func NewUserRequiredCompleteInstallationResetEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *UserRequiredCompleteInstallationResetEvent { - return &UserRequiredCompleteInstallationResetEvent{ - eventName: UserRequiredCompleteInstallationResetEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &UserRequiredCompleteInstallationResetEvent{ + eventName: UserRequiredCompleteInstallationResetEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendUserRequiredCompleteInstallationResetEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewUserRequiredCompleteInstallationResetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewUserRequiredCompleteInstallationResetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendUserRequiredCompleteInstallationResetEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewUserRequiredCompleteInstallationResetEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewUserRequiredCompleteInstallationResetEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *UserRequiredCompleteInstallationResetEvent) GetName() string { - return e.eventName + return e.eventName } func (e *UserRequiredCompleteInstallationResetEvent) GetSeverity() string { - return "info" + return "info" } func (e *UserRequiredCompleteInstallationResetEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *UserRequiredCompleteInstallationResetEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *UserRequiredCompleteInstallationResetEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *UserRequiredCompleteInstallationResetEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *UserRequiredCompleteInstallationResetEvent) FormatMessage() string { - s := "User action is required in order to complete installation reset for host {host_name}" - return e.format(&s) + s := "User action is required in order to complete installation reset for host {host_name}" + return e.format(&s) } -// // Event host_set_status_failed -// type HostSetStatusFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - Error string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + Error string } var HostSetStatusFailedEventName string = "host_set_status_failed" func NewHostSetStatusFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, ) *HostSetStatusFailedEvent { - return &HostSetStatusFailedEvent{ - eventName: HostSetStatusFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - Error: error, - } + return &HostSetStatusFailedEvent{ + eventName: HostSetStatusFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + Error: error, + } } func SendHostSetStatusFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string,) { - ev := NewHostSetStatusFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string) { + ev := NewHostSetStatusFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostSetStatusFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - error string, - eventTime time.Time) { - ev := NewHostSetStatusFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - error, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + error string, + eventTime time.Time) { + ev := NewHostSetStatusFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + error, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostSetStatusFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostSetStatusFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostSetStatusFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostSetStatusFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostSetStatusFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostSetStatusFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *HostSetStatusFailedEvent) FormatMessage() string { - s := "Failed to set status of host {host_name} to reset-pending-user-action. Error: {error}" - return e.format(&s) + s := "Failed to set status of host {host_name} to reset-pending-user-action. Error: {error}" + return e.format(&s) } -// // Event host_validation_failed -// type HostValidationFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - ValidationId string - FailureMessage string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + ValidationId string + FailureMessage string } var HostValidationFailedEventName string = "host_validation_failed" func NewHostValidationFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string, - failureMessage string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string, + failureMessage string, ) *HostValidationFailedEvent { - return &HostValidationFailedEvent{ - eventName: HostValidationFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - ValidationId: validationId, - FailureMessage: failureMessage, - } + return &HostValidationFailedEvent{ + eventName: HostValidationFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + ValidationId: validationId, + FailureMessage: failureMessage, + } } func SendHostValidationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string, - failureMessage string,) { - ev := NewHostValidationFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - validationId, - failureMessage, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string, + failureMessage string) { + ev := NewHostValidationFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + validationId, + failureMessage, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostValidationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string, - failureMessage string, - eventTime time.Time) { - ev := NewHostValidationFailedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - validationId, - failureMessage, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string, + failureMessage string, + eventTime time.Time) { + ev := NewHostValidationFailedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + validationId, + failureMessage, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostValidationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostValidationFailedEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *HostValidationFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostValidationFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostValidationFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostValidationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{validation_id}", fmt.Sprint(e.ValidationId), - "{failure_message}", fmt.Sprint(e.FailureMessage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{validation_id}", fmt.Sprint(e.ValidationId), + "{failure_message}", fmt.Sprint(e.FailureMessage), + ) + return r.Replace(*message) } func (e *HostValidationFailedEvent) FormatMessage() string { - s := "Host {host_name}: validation '{validation_id}' {failure_message}" - return e.format(&s) + s := "Host {host_name}: validation '{validation_id}' {failure_message}" + return e.format(&s) } -// // Event host_validation_fixed -// type HostValidationFixedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - ValidationId string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + ValidationId string } var HostValidationFixedEventName string = "host_validation_fixed" func NewHostValidationFixedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string, ) *HostValidationFixedEvent { - return &HostValidationFixedEvent{ - eventName: HostValidationFixedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - ValidationId: validationId, - } + return &HostValidationFixedEvent{ + eventName: HostValidationFixedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + ValidationId: validationId, + } } func SendHostValidationFixedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string,) { - ev := NewHostValidationFixedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - validationId, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string) { + ev := NewHostValidationFixedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + validationId, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostValidationFixedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - validationId string, - eventTime time.Time) { - ev := NewHostValidationFixedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - validationId, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + validationId string, + eventTime time.Time) { + ev := NewHostValidationFixedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + validationId, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostValidationFixedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostValidationFixedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostValidationFixedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostValidationFixedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostValidationFixedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostValidationFixedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{validation_id}", fmt.Sprint(e.ValidationId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{validation_id}", fmt.Sprint(e.ValidationId), + ) + return r.Replace(*message) } func (e *HostValidationFixedEvent) FormatMessage() string { - s := "Host {host_name}: validation '{validation_id}' is now fixed" - return e.format(&s) + s := "Host {host_name}: validation '{validation_id}' is now fixed" + return e.format(&s) } -// // Event quick_disk_format_performed -// type QuickDiskFormatPerformedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - DiskName string - DiskId string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + DiskName string + DiskId string } var QuickDiskFormatPerformedEventName string = "quick_disk_format_performed" func NewQuickDiskFormatPerformedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string, ) *QuickDiskFormatPerformedEvent { - return &QuickDiskFormatPerformedEvent{ - eventName: QuickDiskFormatPerformedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - DiskName: diskName, - DiskId: diskId, - } + return &QuickDiskFormatPerformedEvent{ + eventName: QuickDiskFormatPerformedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + DiskName: diskName, + DiskId: diskId, + } } func SendQuickDiskFormatPerformedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string,) { - ev := NewQuickDiskFormatPerformedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - diskName, - diskId, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string) { + ev := NewQuickDiskFormatPerformedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + diskName, + diskId, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendQuickDiskFormatPerformedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string, - eventTime time.Time) { - ev := NewQuickDiskFormatPerformedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - diskName, - diskId, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string, + eventTime time.Time) { + ev := NewQuickDiskFormatPerformedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + diskName, + diskId, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *QuickDiskFormatPerformedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *QuickDiskFormatPerformedEvent) GetSeverity() string { - return "info" + return "info" } func (e *QuickDiskFormatPerformedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *QuickDiskFormatPerformedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *QuickDiskFormatPerformedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *QuickDiskFormatPerformedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{disk_name}", fmt.Sprint(e.DiskName), - "{disk_id}", fmt.Sprint(e.DiskId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{disk_name}", fmt.Sprint(e.DiskName), + "{disk_id}", fmt.Sprint(e.DiskId), + ) + return r.Replace(*message) } func (e *QuickDiskFormatPerformedEvent) FormatMessage() string { - s := "{host_name}: Performing quick format of disk {disk_name}({disk_id})" - return e.format(&s) + s := "{host_name}: Performing quick format of disk {disk_name}({disk_id})" + return e.format(&s) } -// // Event quick_disk_format_skipped -// type QuickDiskFormatSkippedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - DiskName string - DiskId string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + DiskName string + DiskId string } var QuickDiskFormatSkippedEventName string = "quick_disk_format_skipped" func NewQuickDiskFormatSkippedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string, ) *QuickDiskFormatSkippedEvent { - return &QuickDiskFormatSkippedEvent{ - eventName: QuickDiskFormatSkippedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - DiskName: diskName, - DiskId: diskId, - } + return &QuickDiskFormatSkippedEvent{ + eventName: QuickDiskFormatSkippedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + DiskName: diskName, + DiskId: diskId, + } } func SendQuickDiskFormatSkippedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string,) { - ev := NewQuickDiskFormatSkippedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - diskName, - diskId, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string) { + ev := NewQuickDiskFormatSkippedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + diskName, + diskId, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendQuickDiskFormatSkippedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - diskName string, - diskId string, - eventTime time.Time) { - ev := NewQuickDiskFormatSkippedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - diskName, - diskId, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + diskName string, + diskId string, + eventTime time.Time) { + ev := NewQuickDiskFormatSkippedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + diskName, + diskId, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *QuickDiskFormatSkippedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *QuickDiskFormatSkippedEvent) GetSeverity() string { - return "info" + return "info" } func (e *QuickDiskFormatSkippedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *QuickDiskFormatSkippedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *QuickDiskFormatSkippedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *QuickDiskFormatSkippedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{disk_name}", fmt.Sprint(e.DiskName), - "{disk_id}", fmt.Sprint(e.DiskId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{disk_name}", fmt.Sprint(e.DiskName), + "{disk_id}", fmt.Sprint(e.DiskId), + ) + return r.Replace(*message) } func (e *QuickDiskFormatSkippedEvent) FormatMessage() string { - s := "{host_name}: Skipping quick format of disk {disk_name}({disk_id}) due to user request. This could lead to boot order issues during installation" - return e.format(&s) + s := "{host_name}: Skipping quick format of disk {disk_name}({disk_id}) due to user request. This could lead to boot order issues during installation" + return e.format(&s) } -// // Event infra_env_registration_failed -// type InfraEnvRegistrationFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID - Error string + eventName string + InfraEnvId strfmt.UUID + Error string } var InfraEnvRegistrationFailedEventName string = "infra_env_registration_failed" func NewInfraEnvRegistrationFailedEvent( - infraEnvId strfmt.UUID, - error string, + infraEnvId strfmt.UUID, + error string, ) *InfraEnvRegistrationFailedEvent { - return &InfraEnvRegistrationFailedEvent{ - eventName: InfraEnvRegistrationFailedEventName, - InfraEnvId: infraEnvId, - Error: error, - } + return &InfraEnvRegistrationFailedEvent{ + eventName: InfraEnvRegistrationFailedEventName, + InfraEnvId: infraEnvId, + Error: error, + } } func SendInfraEnvRegistrationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - error string,) { - ev := NewInfraEnvRegistrationFailedEvent( - infraEnvId, - error, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + error string) { + ev := NewInfraEnvRegistrationFailedEvent( + infraEnvId, + error, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendInfraEnvRegistrationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewInfraEnvRegistrationFailedEvent( - infraEnvId, - error, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewInfraEnvRegistrationFailedEvent( + infraEnvId, + error, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *InfraEnvRegistrationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InfraEnvRegistrationFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *InfraEnvRegistrationFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *InfraEnvRegistrationFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *InfraEnvRegistrationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *InfraEnvRegistrationFailedEvent) FormatMessage() string { - s := "Failed to register infra env. Error: {error}" - return e.format(&s) + s := "Failed to register infra env. Error: {error}" + return e.format(&s) } -// // Event infra_env_registered -// type InfraEnvRegisteredEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var InfraEnvRegisteredEventName string = "infra_env_registered" func NewInfraEnvRegisteredEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *InfraEnvRegisteredEvent { - return &InfraEnvRegisteredEvent{ - eventName: InfraEnvRegisteredEventName, - InfraEnvId: infraEnvId, - } + return &InfraEnvRegisteredEvent{ + eventName: InfraEnvRegisteredEventName, + InfraEnvId: infraEnvId, + } } func SendInfraEnvRegisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewInfraEnvRegisteredEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewInfraEnvRegisteredEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendInfraEnvRegisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewInfraEnvRegisteredEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewInfraEnvRegisteredEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *InfraEnvRegisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InfraEnvRegisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *InfraEnvRegisteredEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *InfraEnvRegisteredEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *InfraEnvRegisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *InfraEnvRegisteredEvent) FormatMessage() string { - s := "Registered infra env" - return e.format(&s) + s := "Registered infra env" + return e.format(&s) } -// // Event infra_env_deregister_failed -// type InfraEnvDeregisterFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID - Error string + eventName string + InfraEnvId strfmt.UUID + Error string } var InfraEnvDeregisterFailedEventName string = "infra_env_deregister_failed" func NewInfraEnvDeregisterFailedEvent( - infraEnvId strfmt.UUID, - error string, + infraEnvId strfmt.UUID, + error string, ) *InfraEnvDeregisterFailedEvent { - return &InfraEnvDeregisterFailedEvent{ - eventName: InfraEnvDeregisterFailedEventName, - InfraEnvId: infraEnvId, - Error: error, - } + return &InfraEnvDeregisterFailedEvent{ + eventName: InfraEnvDeregisterFailedEventName, + InfraEnvId: infraEnvId, + Error: error, + } } func SendInfraEnvDeregisterFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - error string,) { - ev := NewInfraEnvDeregisterFailedEvent( - infraEnvId, - error, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + error string) { + ev := NewInfraEnvDeregisterFailedEvent( + infraEnvId, + error, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendInfraEnvDeregisterFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - error string, - eventTime time.Time) { - ev := NewInfraEnvDeregisterFailedEvent( - infraEnvId, - error, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + error string, + eventTime time.Time) { + ev := NewInfraEnvDeregisterFailedEvent( + infraEnvId, + error, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *InfraEnvDeregisterFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InfraEnvDeregisterFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *InfraEnvDeregisterFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *InfraEnvDeregisterFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *InfraEnvDeregisterFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{error}", fmt.Sprint(e.Error), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{error}", fmt.Sprint(e.Error), + ) + return r.Replace(*message) } func (e *InfraEnvDeregisterFailedEvent) FormatMessage() string { - s := "Failed to deregister infra env. Error: {error}" - return e.format(&s) + s := "Failed to deregister infra env. Error: {error}" + return e.format(&s) } -// // Event infra_env_deregistered -// type InfraEnvDeregisteredEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var InfraEnvDeregisteredEventName string = "infra_env_deregistered" func NewInfraEnvDeregisteredEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *InfraEnvDeregisteredEvent { - return &InfraEnvDeregisteredEvent{ - eventName: InfraEnvDeregisteredEventName, - InfraEnvId: infraEnvId, - } + return &InfraEnvDeregisteredEvent{ + eventName: InfraEnvDeregisteredEventName, + InfraEnvId: infraEnvId, + } } func SendInfraEnvDeregisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewInfraEnvDeregisteredEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewInfraEnvDeregisteredEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendInfraEnvDeregisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewInfraEnvDeregisteredEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewInfraEnvDeregisteredEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *InfraEnvDeregisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InfraEnvDeregisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *InfraEnvDeregisteredEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *InfraEnvDeregisteredEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *InfraEnvDeregisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *InfraEnvDeregisteredEvent) FormatMessage() string { - s := "Deregistered infra env" - return e.format(&s) + s := "Deregistered infra env" + return e.format(&s) } -// // Event generate_image_fetch_failed -// type GenerateImageFetchFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var GenerateImageFetchFailedEventName string = "generate_image_fetch_failed" func NewGenerateImageFetchFailedEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *GenerateImageFetchFailedEvent { - return &GenerateImageFetchFailedEvent{ - eventName: GenerateImageFetchFailedEventName, - InfraEnvId: infraEnvId, - } + return &GenerateImageFetchFailedEvent{ + eventName: GenerateImageFetchFailedEventName, + InfraEnvId: infraEnvId, + } } func SendGenerateImageFetchFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewGenerateImageFetchFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewGenerateImageFetchFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendGenerateImageFetchFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewGenerateImageFetchFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewGenerateImageFetchFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *GenerateImageFetchFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *GenerateImageFetchFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *GenerateImageFetchFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *GenerateImageFetchFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *GenerateImageFetchFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *GenerateImageFetchFailedEvent) FormatMessage() string { - s := "Failed to generate image: error fetching updated infra env metadata" - return e.format(&s) + s := "Failed to generate image: error fetching updated infra env metadata" + return e.format(&s) } -// // Event existing_image_reused -// type ExistingImageReusedEvent struct { - eventName string - InfraEnvId strfmt.UUID - ImageType string + eventName string + InfraEnvId strfmt.UUID + ImageType string } var ExistingImageReusedEventName string = "existing_image_reused" func NewExistingImageReusedEvent( - infraEnvId strfmt.UUID, - imageType string, + infraEnvId strfmt.UUID, + imageType string, ) *ExistingImageReusedEvent { - return &ExistingImageReusedEvent{ - eventName: ExistingImageReusedEventName, - InfraEnvId: infraEnvId, - ImageType: imageType, - } + return &ExistingImageReusedEvent{ + eventName: ExistingImageReusedEventName, + InfraEnvId: infraEnvId, + ImageType: imageType, + } } func SendExistingImageReusedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - imageType string,) { - ev := NewExistingImageReusedEvent( - infraEnvId, - imageType, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + imageType string) { + ev := NewExistingImageReusedEvent( + infraEnvId, + imageType, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendExistingImageReusedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - imageType string, - eventTime time.Time) { - ev := NewExistingImageReusedEvent( - infraEnvId, - imageType, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + imageType string, + eventTime time.Time) { + ev := NewExistingImageReusedEvent( + infraEnvId, + imageType, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *ExistingImageReusedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ExistingImageReusedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ExistingImageReusedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *ExistingImageReusedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *ExistingImageReusedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{image_type}", fmt.Sprint(e.ImageType), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{image_type}", fmt.Sprint(e.ImageType), + ) + return r.Replace(*message) } func (e *ExistingImageReusedEvent) FormatMessage() string { - s := "Re-used existing image rather than generating a new one (image type is '{image_type}')" - return e.format(&s) + s := "Re-used existing image rather than generating a new one (image type is '{image_type}')" + return e.format(&s) } -// // Event install_config_applied -// type InstallConfigAppliedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var InstallConfigAppliedEventName string = "install_config_applied" func NewInstallConfigAppliedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *InstallConfigAppliedEvent { - return &InstallConfigAppliedEvent{ - eventName: InstallConfigAppliedEventName, - ClusterId: clusterId, - } + return &InstallConfigAppliedEvent{ + eventName: InstallConfigAppliedEventName, + ClusterId: clusterId, + } } func SendInstallConfigAppliedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewInstallConfigAppliedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewInstallConfigAppliedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendInstallConfigAppliedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewInstallConfigAppliedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewInstallConfigAppliedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *InstallConfigAppliedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InstallConfigAppliedEvent) GetSeverity() string { - return "info" + return "info" } func (e *InstallConfigAppliedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *InstallConfigAppliedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *InstallConfigAppliedEvent) FormatMessage() string { - s := "Custom install config was applied to the cluster" - return e.format(&s) + s := "Custom install config was applied to the cluster" + return e.format(&s) } -// // Event proxy_settings_changed -// type ProxySettingsChangedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ProxySettingsChangedEventName string = "proxy_settings_changed" func NewProxySettingsChangedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ProxySettingsChangedEvent { - return &ProxySettingsChangedEvent{ - eventName: ProxySettingsChangedEventName, - ClusterId: clusterId, - } + return &ProxySettingsChangedEvent{ + eventName: ProxySettingsChangedEventName, + ClusterId: clusterId, + } } func SendProxySettingsChangedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewProxySettingsChangedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewProxySettingsChangedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendProxySettingsChangedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewProxySettingsChangedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewProxySettingsChangedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ProxySettingsChangedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ProxySettingsChangedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ProxySettingsChangedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ProxySettingsChangedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ProxySettingsChangedEvent) FormatMessage() string { - s := "Proxy settings changed" - return e.format(&s) + s := "Proxy settings changed" + return e.format(&s) } -// // Event disk_speed_slower_than_supported -// type DiskSpeedSlowerThanSupportedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostDisk string - FdatasyncDuration int64 + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostDisk string + FdatasyncDuration int64 } var DiskSpeedSlowerThanSupportedEventName string = "disk_speed_slower_than_supported" func NewDiskSpeedSlowerThanSupportedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostDisk string, - fdatasyncDuration int64, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostDisk string, + fdatasyncDuration int64, ) *DiskSpeedSlowerThanSupportedEvent { - return &DiskSpeedSlowerThanSupportedEvent{ - eventName: DiskSpeedSlowerThanSupportedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostDisk: hostDisk, - FdatasyncDuration: fdatasyncDuration, - } + return &DiskSpeedSlowerThanSupportedEvent{ + eventName: DiskSpeedSlowerThanSupportedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostDisk: hostDisk, + FdatasyncDuration: fdatasyncDuration, + } } func SendDiskSpeedSlowerThanSupportedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostDisk string, - fdatasyncDuration int64,) { - ev := NewDiskSpeedSlowerThanSupportedEvent( - hostId, - infraEnvId, - clusterId, - hostDisk, - fdatasyncDuration, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostDisk string, + fdatasyncDuration int64) { + ev := NewDiskSpeedSlowerThanSupportedEvent( + hostId, + infraEnvId, + clusterId, + hostDisk, + fdatasyncDuration, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendDiskSpeedSlowerThanSupportedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostDisk string, - fdatasyncDuration int64, - eventTime time.Time) { - ev := NewDiskSpeedSlowerThanSupportedEvent( - hostId, - infraEnvId, - clusterId, - hostDisk, - fdatasyncDuration, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostDisk string, + fdatasyncDuration int64, + eventTime time.Time) { + ev := NewDiskSpeedSlowerThanSupportedEvent( + hostId, + infraEnvId, + clusterId, + hostDisk, + fdatasyncDuration, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *DiskSpeedSlowerThanSupportedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *DiskSpeedSlowerThanSupportedEvent) GetSeverity() string { - return "warning" + return "warning" } func (e *DiskSpeedSlowerThanSupportedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *DiskSpeedSlowerThanSupportedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *DiskSpeedSlowerThanSupportedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *DiskSpeedSlowerThanSupportedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_disk}", fmt.Sprint(e.HostDisk), - "{fdatasync_duration}", fmt.Sprint(e.FdatasyncDuration), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_disk}", fmt.Sprint(e.HostDisk), + "{fdatasync_duration}", fmt.Sprint(e.FdatasyncDuration), + ) + return r.Replace(*message) } func (e *DiskSpeedSlowerThanSupportedEvent) FormatMessage() string { - s := "Host's disk {host_disk} is slower than the supported speed, and may cause degraded cluster performance (fdatasync duration: {fdatasync_duration} ms)" - return e.format(&s) + s := "Host's disk {host_disk} is slower than the supported speed, and may cause degraded cluster performance (fdatasync duration: {fdatasync_duration} ms)" + return e.format(&s) } -// // Event host_discovery_ignition_config_applied -// type HostDiscoveryIgnitionConfigAppliedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + HostName string } var HostDiscoveryIgnitionConfigAppliedEventName string = "host_discovery_ignition_config_applied" func NewHostDiscoveryIgnitionConfigAppliedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, ) *HostDiscoveryIgnitionConfigAppliedEvent { - return &HostDiscoveryIgnitionConfigAppliedEvent{ - eventName: HostDiscoveryIgnitionConfigAppliedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - HostName: hostName, - } + return &HostDiscoveryIgnitionConfigAppliedEvent{ + eventName: HostDiscoveryIgnitionConfigAppliedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + HostName: hostName, + } } func SendHostDiscoveryIgnitionConfigAppliedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string,) { - ev := NewHostDiscoveryIgnitionConfigAppliedEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string) { + ev := NewHostDiscoveryIgnitionConfigAppliedEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostDiscoveryIgnitionConfigAppliedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostDiscoveryIgnitionConfigAppliedEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostDiscoveryIgnitionConfigAppliedEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostDiscoveryIgnitionConfigAppliedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostDiscoveryIgnitionConfigAppliedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostDiscoveryIgnitionConfigAppliedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *HostDiscoveryIgnitionConfigAppliedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostDiscoveryIgnitionConfigAppliedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostDiscoveryIgnitionConfigAppliedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostDiscoveryIgnitionConfigAppliedEvent) FormatMessage() string { - s := "Host {host_name}: custom discovery ignition config was applied" - return e.format(&s) + s := "Host {host_name}: custom discovery ignition config was applied" + return e.format(&s) } -// // Event host_reset_fetch_failed -// type HostResetFetchFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + HostName string } var HostResetFetchFailedEventName string = "host_reset_fetch_failed" func NewHostResetFetchFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, ) *HostResetFetchFailedEvent { - return &HostResetFetchFailedEvent{ - eventName: HostResetFetchFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - HostName: hostName, - } + return &HostResetFetchFailedEvent{ + eventName: HostResetFetchFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + HostName: hostName, + } } func SendHostResetFetchFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string,) { - ev := NewHostResetFetchFailedEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string) { + ev := NewHostResetFetchFailedEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostResetFetchFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostResetFetchFailedEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostResetFetchFailedEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostResetFetchFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostResetFetchFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostResetFetchFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *HostResetFetchFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostResetFetchFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostResetFetchFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostResetFetchFailedEvent) FormatMessage() string { - s := "Failed to reset host {host_name}: error fetching host from DB" - return e.format(&s) + s := "Failed to reset host {host_name}: error fetching host from DB" + return e.format(&s) } -// // Event host_boot_logs_uploaded -// type HostBootLogsUploadedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostBootLogsUploadedEventName string = "host_boot_logs_uploaded" func NewHostBootLogsUploadedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostBootLogsUploadedEvent { - return &HostBootLogsUploadedEvent{ - eventName: HostBootLogsUploadedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostBootLogsUploadedEvent{ + eventName: HostBootLogsUploadedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostBootLogsUploadedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostBootLogsUploadedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostBootLogsUploadedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostBootLogsUploadedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostBootLogsUploadedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostBootLogsUploadedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostBootLogsUploadedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostBootLogsUploadedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostBootLogsUploadedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostBootLogsUploadedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostBootLogsUploadedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostBootLogsUploadedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostBootLogsUploadedEvent) FormatMessage() string { - s := "Uploaded node boot logs for host {host_name} cluster {cluster_id}" - return e.format(&s) + s := "Uploaded node boot logs for host {host_name} cluster {cluster_id}" + return e.format(&s) } -// // Event host_logs_uploaded -// type HostLogsUploadedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostLogsUploadedEventName string = "host_logs_uploaded" func NewHostLogsUploadedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostLogsUploadedEvent { - return &HostLogsUploadedEvent{ - eventName: HostLogsUploadedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostLogsUploadedEvent{ + eventName: HostLogsUploadedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostLogsUploadedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostLogsUploadedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostLogsUploadedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostLogsUploadedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostLogsUploadedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostLogsUploadedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostLogsUploadedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostLogsUploadedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostLogsUploadedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostLogsUploadedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostLogsUploadedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostLogsUploadedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostLogsUploadedEvent) FormatMessage() string { - s := "Uploaded logs for host {host_name} cluster {cluster_id}" - return e.format(&s) + s := "Uploaded logs for host {host_name} cluster {cluster_id}" + return e.format(&s) } -// // Event cluster_logs_uploaded -// type ClusterLogsUploadedEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ClusterLogsUploadedEventName string = "cluster_logs_uploaded" func NewClusterLogsUploadedEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ClusterLogsUploadedEvent { - return &ClusterLogsUploadedEvent{ - eventName: ClusterLogsUploadedEventName, - ClusterId: clusterId, - } + return &ClusterLogsUploadedEvent{ + eventName: ClusterLogsUploadedEventName, + ClusterId: clusterId, + } } func SendClusterLogsUploadedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewClusterLogsUploadedEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewClusterLogsUploadedEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClusterLogsUploadedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewClusterLogsUploadedEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewClusterLogsUploadedEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClusterLogsUploadedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClusterLogsUploadedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClusterLogsUploadedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClusterLogsUploadedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ClusterLogsUploadedEvent) FormatMessage() string { - s := "Uploaded logs for the cluster" - return e.format(&s) + s := "Uploaded logs for the cluster" + return e.format(&s) } -// // Event host_approved_updated -// type HostApprovedUpdatedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - HostName string - ApprovedValue bool + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + HostName string + ApprovedValue bool } var HostApprovedUpdatedEventName string = "host_approved_updated" func NewHostApprovedUpdatedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - approvedValue bool, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + approvedValue bool, ) *HostApprovedUpdatedEvent { - return &HostApprovedUpdatedEvent{ - eventName: HostApprovedUpdatedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - HostName: hostName, - ApprovedValue: approvedValue, - } + return &HostApprovedUpdatedEvent{ + eventName: HostApprovedUpdatedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + HostName: hostName, + ApprovedValue: approvedValue, + } } func SendHostApprovedUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - approvedValue bool,) { - ev := NewHostApprovedUpdatedEvent( - hostId, - infraEnvId, - hostName, - approvedValue, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + approvedValue bool) { + ev := NewHostApprovedUpdatedEvent( + hostId, + infraEnvId, + hostName, + approvedValue, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostApprovedUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - approvedValue bool, - eventTime time.Time) { - ev := NewHostApprovedUpdatedEvent( - hostId, - infraEnvId, - hostName, - approvedValue, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + approvedValue bool, + eventTime time.Time) { + ev := NewHostApprovedUpdatedEvent( + hostId, + infraEnvId, + hostName, + approvedValue, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostApprovedUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostApprovedUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostApprovedUpdatedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *HostApprovedUpdatedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostApprovedUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostApprovedUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{host_name}", fmt.Sprint(e.HostName), - "{approved_value}", fmt.Sprint(e.ApprovedValue), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{host_name}", fmt.Sprint(e.HostName), + "{approved_value}", fmt.Sprint(e.ApprovedValue), + ) + return r.Replace(*message) } func (e *HostApprovedUpdatedEvent) FormatMessage() string { - s := "Host {host_name}: updated approved to {approved_value}" - return e.format(&s) + s := "Host {host_name}: updated approved to {approved_value}" + return e.format(&s) } -// // Event host_registration_succeeded -// type HostRegistrationSucceededEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostRegistrationSucceededEventName string = "host_registration_succeeded" func NewHostRegistrationSucceededEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostRegistrationSucceededEvent { - return &HostRegistrationSucceededEvent{ - eventName: HostRegistrationSucceededEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostRegistrationSucceededEvent{ + eventName: HostRegistrationSucceededEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostRegistrationSucceededEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostRegistrationSucceededEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostRegistrationSucceededEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostRegistrationSucceededEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostRegistrationSucceededEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostRegistrationSucceededEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostRegistrationSucceededEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostRegistrationSucceededEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostRegistrationSucceededEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostRegistrationSucceededEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostRegistrationSucceededEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostRegistrationSucceededEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostRegistrationSucceededEvent) FormatMessage() string { - s := "Host {host_name}: Successfully registered" - return e.format(&s) + s := "Host {host_name}: Successfully registered" + return e.format(&s) } -// // Event host_bind_succeeded -// type HostBindSucceededEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string } var HostBindSucceededEventName string = "host_bind_succeeded" func NewHostBindSucceededEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, ) *HostBindSucceededEvent { - return &HostBindSucceededEvent{ - eventName: HostBindSucceededEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - } + return &HostBindSucceededEvent{ + eventName: HostBindSucceededEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + } } func SendHostBindSucceededEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string,) { - ev := NewHostBindSucceededEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string) { + ev := NewHostBindSucceededEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostBindSucceededEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostBindSucceededEvent( - hostId, - infraEnvId, - clusterId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostBindSucceededEvent( + hostId, + infraEnvId, + clusterId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostBindSucceededEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostBindSucceededEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostBindSucceededEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostBindSucceededEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostBindSucceededEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostBindSucceededEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostBindSucceededEvent) FormatMessage() string { - s := "Host {host_name}: Successfully bound to cluster {cluster_id}" - return e.format(&s) + s := "Host {host_name}: Successfully bound to cluster {cluster_id}" + return e.format(&s) } -// // Event host_unbind_succeeded -// type HostUnbindSucceededEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - HostName string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + HostName string } var HostUnbindSucceededEventName string = "host_unbind_succeeded" func NewHostUnbindSucceededEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, ) *HostUnbindSucceededEvent { - return &HostUnbindSucceededEvent{ - eventName: HostUnbindSucceededEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - HostName: hostName, - } + return &HostUnbindSucceededEvent{ + eventName: HostUnbindSucceededEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + HostName: hostName, + } } func SendHostUnbindSucceededEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string,) { - ev := NewHostUnbindSucceededEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string) { + ev := NewHostUnbindSucceededEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostUnbindSucceededEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - hostName string, - eventTime time.Time) { - ev := NewHostUnbindSucceededEvent( - hostId, - infraEnvId, - hostName, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + hostName string, + eventTime time.Time) { + ev := NewHostUnbindSucceededEvent( + hostId, + infraEnvId, + hostName, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostUnbindSucceededEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostUnbindSucceededEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostUnbindSucceededEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *HostUnbindSucceededEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostUnbindSucceededEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostUnbindSucceededEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{host_name}", fmt.Sprint(e.HostName), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{host_name}", fmt.Sprint(e.HostName), + ) + return r.Replace(*message) } func (e *HostUnbindSucceededEvent) FormatMessage() string { - s := "Host {host_name}: Successfully unbound from cluster" - return e.format(&s) + s := "Host {host_name}: Successfully unbound from cluster" + return e.format(&s) } -// // Event generate_image_format_failed -// type GenerateImageFormatFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var GenerateImageFormatFailedEventName string = "generate_image_format_failed" func NewGenerateImageFormatFailedEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *GenerateImageFormatFailedEvent { - return &GenerateImageFormatFailedEvent{ - eventName: GenerateImageFormatFailedEventName, - InfraEnvId: infraEnvId, - } + return &GenerateImageFormatFailedEvent{ + eventName: GenerateImageFormatFailedEventName, + InfraEnvId: infraEnvId, + } } func SendGenerateImageFormatFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewGenerateImageFormatFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewGenerateImageFormatFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendGenerateImageFormatFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewGenerateImageFormatFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewGenerateImageFormatFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *GenerateImageFormatFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *GenerateImageFormatFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *GenerateImageFormatFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *GenerateImageFormatFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *GenerateImageFormatFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *GenerateImageFormatFailedEvent) FormatMessage() string { - s := "Failed to generate image: error formatting ignition file" - return e.format(&s) + s := "Failed to generate image: error formatting ignition file" + return e.format(&s) } -// // Event generate_minimal_iso_failed -// type GenerateMinimalIsoFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var GenerateMinimalIsoFailedEventName string = "generate_minimal_iso_failed" func NewGenerateMinimalIsoFailedEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *GenerateMinimalIsoFailedEvent { - return &GenerateMinimalIsoFailedEvent{ - eventName: GenerateMinimalIsoFailedEventName, - InfraEnvId: infraEnvId, - } + return &GenerateMinimalIsoFailedEvent{ + eventName: GenerateMinimalIsoFailedEventName, + InfraEnvId: infraEnvId, + } } func SendGenerateMinimalIsoFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewGenerateMinimalIsoFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewGenerateMinimalIsoFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendGenerateMinimalIsoFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewGenerateMinimalIsoFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewGenerateMinimalIsoFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *GenerateMinimalIsoFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *GenerateMinimalIsoFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *GenerateMinimalIsoFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *GenerateMinimalIsoFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *GenerateMinimalIsoFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *GenerateMinimalIsoFailedEvent) FormatMessage() string { - s := "Failed to generate minimal ISO" - return e.format(&s) + s := "Failed to generate minimal ISO" + return e.format(&s) } -// // Event upload_image_failed -// type UploadImageFailedEvent struct { - eventName string - InfraEnvId strfmt.UUID + eventName string + InfraEnvId strfmt.UUID } var UploadImageFailedEventName string = "upload_image_failed" func NewUploadImageFailedEvent( - infraEnvId strfmt.UUID, + infraEnvId strfmt.UUID, ) *UploadImageFailedEvent { - return &UploadImageFailedEvent{ - eventName: UploadImageFailedEventName, - InfraEnvId: infraEnvId, - } + return &UploadImageFailedEvent{ + eventName: UploadImageFailedEventName, + InfraEnvId: infraEnvId, + } } func SendUploadImageFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID,) { - ev := NewUploadImageFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID) { + ev := NewUploadImageFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendUploadImageFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - eventTime time.Time) { - ev := NewUploadImageFailedEvent( - infraEnvId, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + eventTime time.Time) { + ev := NewUploadImageFailedEvent( + infraEnvId, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *UploadImageFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *UploadImageFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *UploadImageFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *UploadImageFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *UploadImageFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + ) + return r.Replace(*message) } func (e *UploadImageFailedEvent) FormatMessage() string { - s := "Failed to upload image" - return e.format(&s) + s := "Failed to upload image" + return e.format(&s) } -// // Event ignition_config_image_generated -// type IgnitionConfigImageGeneratedEvent struct { - eventName string - InfraEnvId strfmt.UUID - Details string + eventName string + InfraEnvId strfmt.UUID + Details string } var IgnitionConfigImageGeneratedEventName string = "ignition_config_image_generated" func NewIgnitionConfigImageGeneratedEvent( - infraEnvId strfmt.UUID, - details string, + infraEnvId strfmt.UUID, + details string, ) *IgnitionConfigImageGeneratedEvent { - return &IgnitionConfigImageGeneratedEvent{ - eventName: IgnitionConfigImageGeneratedEventName, - InfraEnvId: infraEnvId, - Details: details, - } + return &IgnitionConfigImageGeneratedEvent{ + eventName: IgnitionConfigImageGeneratedEventName, + InfraEnvId: infraEnvId, + Details: details, + } } func SendIgnitionConfigImageGeneratedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - details string,) { - ev := NewIgnitionConfigImageGeneratedEvent( - infraEnvId, - details, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + details string) { + ev := NewIgnitionConfigImageGeneratedEvent( + infraEnvId, + details, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendIgnitionConfigImageGeneratedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - infraEnvId strfmt.UUID, - details string, - eventTime time.Time) { - ev := NewIgnitionConfigImageGeneratedEvent( - infraEnvId, - details, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + infraEnvId strfmt.UUID, + details string, + eventTime time.Time) { + ev := NewIgnitionConfigImageGeneratedEvent( + infraEnvId, + details, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *IgnitionConfigImageGeneratedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *IgnitionConfigImageGeneratedEvent) GetSeverity() string { - return "info" + return "info" } func (e *IgnitionConfigImageGeneratedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *IgnitionConfigImageGeneratedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *IgnitionConfigImageGeneratedEvent) format(message *string) string { - r := strings.NewReplacer( - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{details}", fmt.Sprint(e.Details), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{details}", fmt.Sprint(e.Details), + ) + return r.Replace(*message) } func (e *IgnitionConfigImageGeneratedEvent) FormatMessage() string { - s := "Generated image ({details})" - return e.format(&s) + s := "Generated image ({details})" + return e.format(&s) } -// // Event host_install_progress_updated -// type HostInstallProgressUpdatedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - HostName string - Event string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + HostName string + Event string } var HostInstallProgressUpdatedEventName string = "host_install_progress_updated" func NewHostInstallProgressUpdatedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - event string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + event string, ) *HostInstallProgressUpdatedEvent { - return &HostInstallProgressUpdatedEvent{ - eventName: HostInstallProgressUpdatedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - HostName: hostName, - Event: event, - } + return &HostInstallProgressUpdatedEvent{ + eventName: HostInstallProgressUpdatedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + HostName: hostName, + Event: event, + } } func SendHostInstallProgressUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - event string,) { - ev := NewHostInstallProgressUpdatedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - event, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + event string) { + ev := NewHostInstallProgressUpdatedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + event, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostInstallProgressUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - hostName string, - event string, - eventTime time.Time) { - ev := NewHostInstallProgressUpdatedEvent( - hostId, - infraEnvId, - clusterId, - hostName, - event, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + hostName string, + event string, + eventTime time.Time) { + ev := NewHostInstallProgressUpdatedEvent( + hostId, + infraEnvId, + clusterId, + hostName, + event, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostInstallProgressUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostInstallProgressUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *HostInstallProgressUpdatedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostInstallProgressUpdatedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostInstallProgressUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostInstallProgressUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{host_name}", fmt.Sprint(e.HostName), - "{event}", fmt.Sprint(e.Event), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{host_name}", fmt.Sprint(e.HostName), + "{event}", fmt.Sprint(e.Event), + ) + return r.Replace(*message) } func (e *HostInstallProgressUpdatedEvent) FormatMessage() string { - s := "Host: {host_name}, {event}" - return e.format(&s) + s := "Host: {host_name}, {event}" + return e.format(&s) } -// // Event host_registration_failed -// type HostRegistrationFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - Message string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + Message string } var HostRegistrationFailedEventName string = "host_registration_failed" func NewHostRegistrationFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string, ) *HostRegistrationFailedEvent { - return &HostRegistrationFailedEvent{ - eventName: HostRegistrationFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - Message: message, - } + return &HostRegistrationFailedEvent{ + eventName: HostRegistrationFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + Message: message, + } } func SendHostRegistrationFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string,) { - ev := NewHostRegistrationFailedEvent( - hostId, - infraEnvId, - clusterId, - message, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string) { + ev := NewHostRegistrationFailedEvent( + hostId, + infraEnvId, + clusterId, + message, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostRegistrationFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string, - eventTime time.Time) { - ev := NewHostRegistrationFailedEvent( - hostId, - infraEnvId, - clusterId, - message, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string, + eventTime time.Time) { + ev := NewHostRegistrationFailedEvent( + hostId, + infraEnvId, + clusterId, + message, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostRegistrationFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostRegistrationFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostRegistrationFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostRegistrationFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostRegistrationFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostRegistrationFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{message}", fmt.Sprint(e.Message), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{message}", fmt.Sprint(e.Message), + ) + return r.Replace(*message) } func (e *HostRegistrationFailedEvent) FormatMessage() string { - s := "{message}" - return e.format(&s) + s := "{message}" + return e.format(&s) } -// // Event host_bind_failed -// type HostBindFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - Message string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + Message string } var HostBindFailedEventName string = "host_bind_failed" func NewHostBindFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string, ) *HostBindFailedEvent { - return &HostBindFailedEvent{ - eventName: HostBindFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - Message: message, - } + return &HostBindFailedEvent{ + eventName: HostBindFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + Message: message, + } } func SendHostBindFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string,) { - ev := NewHostBindFailedEvent( - hostId, - infraEnvId, - clusterId, - message, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string) { + ev := NewHostBindFailedEvent( + hostId, + infraEnvId, + clusterId, + message, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostBindFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - message string, - eventTime time.Time) { - ev := NewHostBindFailedEvent( - hostId, - infraEnvId, - clusterId, - message, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + message string, + eventTime time.Time) { + ev := NewHostBindFailedEvent( + hostId, + infraEnvId, + clusterId, + message, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostBindFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostBindFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostBindFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *HostBindFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostBindFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostBindFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{message}", fmt.Sprint(e.Message), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{message}", fmt.Sprint(e.Message), + ) + return r.Replace(*message) } func (e *HostBindFailedEvent) FormatMessage() string { - s := "Failed to bind host {host_id} to cluster {cluster_id}: {message}" - return e.format(&s) + s := "Failed to bind host {host_id} to cluster {cluster_id}: {message}" + return e.format(&s) } -// // Event host_unbind_failed -// type HostUnbindFailedEvent struct { - eventName string - HostId strfmt.UUID - InfraEnvId strfmt.UUID - Message string + eventName string + HostId strfmt.UUID + InfraEnvId strfmt.UUID + Message string } var HostUnbindFailedEventName string = "host_unbind_failed" func NewHostUnbindFailedEvent( - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - message string, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + message string, ) *HostUnbindFailedEvent { - return &HostUnbindFailedEvent{ - eventName: HostUnbindFailedEventName, - HostId: hostId, - InfraEnvId: infraEnvId, - Message: message, - } + return &HostUnbindFailedEvent{ + eventName: HostUnbindFailedEventName, + HostId: hostId, + InfraEnvId: infraEnvId, + Message: message, + } } func SendHostUnbindFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - message string,) { - ev := NewHostUnbindFailedEvent( - hostId, - infraEnvId, - message, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + message string) { + ev := NewHostUnbindFailedEvent( + hostId, + infraEnvId, + message, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendHostUnbindFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - infraEnvId strfmt.UUID, - message string, - eventTime time.Time) { - ev := NewHostUnbindFailedEvent( - hostId, - infraEnvId, - message, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + infraEnvId strfmt.UUID, + message string, + eventTime time.Time) { + ev := NewHostUnbindFailedEvent( + hostId, + infraEnvId, + message, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *HostUnbindFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *HostUnbindFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *HostUnbindFailedEvent) GetClusterId() *strfmt.UUID { - return nil + return nil } func (e *HostUnbindFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *HostUnbindFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *HostUnbindFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{message}", fmt.Sprint(e.Message), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{message}", fmt.Sprint(e.Message), + ) + return r.Replace(*message) } func (e *HostUnbindFailedEvent) FormatMessage() string { - s := "Failed to unbind host {host_id} to cluster: {message}" - return e.format(&s) + s := "Failed to unbind host {host_id} to cluster: {message}" + return e.format(&s) } -// // Event inactive_clusters_deregistered -// type InactiveClustersDeregisteredEvent struct { - eventName string - ClusterId strfmt.UUID - Message string + eventName string + ClusterId strfmt.UUID + Message string } var InactiveClustersDeregisteredEventName string = "inactive_clusters_deregistered" func NewInactiveClustersDeregisteredEvent( - clusterId strfmt.UUID, - message string, + clusterId strfmt.UUID, + message string, ) *InactiveClustersDeregisteredEvent { - return &InactiveClustersDeregisteredEvent{ - eventName: InactiveClustersDeregisteredEventName, - ClusterId: clusterId, - Message: message, - } + return &InactiveClustersDeregisteredEvent{ + eventName: InactiveClustersDeregisteredEventName, + ClusterId: clusterId, + Message: message, + } } func SendInactiveClustersDeregisteredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - message string,) { - ev := NewInactiveClustersDeregisteredEvent( - clusterId, - message, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + message string) { + ev := NewInactiveClustersDeregisteredEvent( + clusterId, + message, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendInactiveClustersDeregisteredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - message string, - eventTime time.Time) { - ev := NewInactiveClustersDeregisteredEvent( - clusterId, - message, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + message string, + eventTime time.Time) { + ev := NewInactiveClustersDeregisteredEvent( + clusterId, + message, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *InactiveClustersDeregisteredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *InactiveClustersDeregisteredEvent) GetSeverity() string { - return "info" + return "info" } func (e *InactiveClustersDeregisteredEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *InactiveClustersDeregisteredEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{message}", fmt.Sprint(e.Message), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{message}", fmt.Sprint(e.Message), + ) + return r.Replace(*message) } func (e *InactiveClustersDeregisteredEvent) FormatMessage() string { - s := "{message}" - return e.format(&s) + s := "{message}" + return e.format(&s) } -// // Event clusters_permanently_deleted -// type ClustersPermanentlyDeletedEvent struct { - eventName string - ClusterId strfmt.UUID - Message string + eventName string + ClusterId strfmt.UUID + Message string } var ClustersPermanentlyDeletedEventName string = "clusters_permanently_deleted" func NewClustersPermanentlyDeletedEvent( - clusterId strfmt.UUID, - message string, + clusterId strfmt.UUID, + message string, ) *ClustersPermanentlyDeletedEvent { - return &ClustersPermanentlyDeletedEvent{ - eventName: ClustersPermanentlyDeletedEventName, - ClusterId: clusterId, - Message: message, - } + return &ClustersPermanentlyDeletedEvent{ + eventName: ClustersPermanentlyDeletedEventName, + ClusterId: clusterId, + Message: message, + } } func SendClustersPermanentlyDeletedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - message string,) { - ev := NewClustersPermanentlyDeletedEvent( - clusterId, - message, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + message string) { + ev := NewClustersPermanentlyDeletedEvent( + clusterId, + message, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendClustersPermanentlyDeletedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - message string, - eventTime time.Time) { - ev := NewClustersPermanentlyDeletedEvent( - clusterId, - message, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + message string, + eventTime time.Time) { + ev := NewClustersPermanentlyDeletedEvent( + clusterId, + message, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ClustersPermanentlyDeletedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ClustersPermanentlyDeletedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ClustersPermanentlyDeletedEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ClustersPermanentlyDeletedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{message}", fmt.Sprint(e.Message), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{message}", fmt.Sprint(e.Message), + ) + return r.Replace(*message) } func (e *ClustersPermanentlyDeletedEvent) FormatMessage() string { - s := "{message}" - return e.format(&s) + s := "{message}" + return e.format(&s) } -// // Event image_info_updated -// type ImageInfoUpdatedEvent struct { - eventName string - ClusterId *strfmt.UUID - InfraEnvId strfmt.UUID - Details string + eventName string + ClusterId *strfmt.UUID + InfraEnvId strfmt.UUID + Details string } var ImageInfoUpdatedEventName string = "image_info_updated" func NewImageInfoUpdatedEvent( - clusterId *strfmt.UUID, - infraEnvId strfmt.UUID, - details string, + clusterId *strfmt.UUID, + infraEnvId strfmt.UUID, + details string, ) *ImageInfoUpdatedEvent { - return &ImageInfoUpdatedEvent{ - eventName: ImageInfoUpdatedEventName, - ClusterId: clusterId, - InfraEnvId: infraEnvId, - Details: details, - } + return &ImageInfoUpdatedEvent{ + eventName: ImageInfoUpdatedEventName, + ClusterId: clusterId, + InfraEnvId: infraEnvId, + Details: details, + } } func SendImageInfoUpdatedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId *strfmt.UUID, - infraEnvId strfmt.UUID, - details string,) { - ev := NewImageInfoUpdatedEvent( - clusterId, - infraEnvId, - details, - ) - eventsHandler.SendInfraEnvEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId *strfmt.UUID, + infraEnvId strfmt.UUID, + details string) { + ev := NewImageInfoUpdatedEvent( + clusterId, + infraEnvId, + details, + ) + eventsHandler.SendInfraEnvEvent(ctx, ev) } func SendImageInfoUpdatedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId *strfmt.UUID, - infraEnvId strfmt.UUID, - details string, - eventTime time.Time) { - ev := NewImageInfoUpdatedEvent( - clusterId, - infraEnvId, - details, - ) - eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId *strfmt.UUID, + infraEnvId strfmt.UUID, + details string, + eventTime time.Time) { + ev := NewImageInfoUpdatedEvent( + clusterId, + infraEnvId, + details, + ) + eventsHandler.SendInfraEnvEventAtTime(ctx, ev, eventTime) } func (e *ImageInfoUpdatedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ImageInfoUpdatedEvent) GetSeverity() string { - return "info" + return "info" } func (e *ImageInfoUpdatedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *ImageInfoUpdatedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *ImageInfoUpdatedEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{details}", fmt.Sprint(e.Details), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{details}", fmt.Sprint(e.Details), + ) + return r.Replace(*message) } func (e *ImageInfoUpdatedEvent) FormatMessage() string { - s := "Updated image information ({details})" - return e.format(&s) + s := "Updated image information ({details})" + return e.format(&s) } -// // Event upgrade_agent_started -// type UpgradeAgentStartedEvent struct { - eventName string - HostId strfmt.UUID - HostName string - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - AgentImage string + eventName string + HostId strfmt.UUID + HostName string + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + AgentImage string } var UpgradeAgentStartedEventName string = "upgrade_agent_started" func NewUpgradeAgentStartedEvent( - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, ) *UpgradeAgentStartedEvent { - return &UpgradeAgentStartedEvent{ - eventName: UpgradeAgentStartedEventName, - HostId: hostId, - HostName: hostName, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - AgentImage: agentImage, - } + return &UpgradeAgentStartedEvent{ + eventName: UpgradeAgentStartedEventName, + HostId: hostId, + HostName: hostName, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + AgentImage: agentImage, + } } func SendUpgradeAgentStartedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string,) { - ev := NewUpgradeAgentStartedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string) { + ev := NewUpgradeAgentStartedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendUpgradeAgentStartedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, - eventTime time.Time) { - ev := NewUpgradeAgentStartedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, + eventTime time.Time) { + ev := NewUpgradeAgentStartedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *UpgradeAgentStartedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *UpgradeAgentStartedEvent) GetSeverity() string { - return "info" + return "info" } func (e *UpgradeAgentStartedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *UpgradeAgentStartedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *UpgradeAgentStartedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *UpgradeAgentStartedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{host_name}", fmt.Sprint(e.HostName), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{agent_image}", fmt.Sprint(e.AgentImage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{host_name}", fmt.Sprint(e.HostName), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{agent_image}", fmt.Sprint(e.AgentImage), + ) + return r.Replace(*message) } func (e *UpgradeAgentStartedEvent) FormatMessage() string { - s := "Host {host_name}: Agent has been instructed to download image '{agent_image}' and restart" - return e.format(&s) + s := "Host {host_name}: Agent has been instructed to download image '{agent_image}' and restart" + return e.format(&s) } -// // Event upgrade_agent_finished -// type UpgradeAgentFinishedEvent struct { - eventName string - HostId strfmt.UUID - HostName string - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - AgentImage string + eventName string + HostId strfmt.UUID + HostName string + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + AgentImage string } var UpgradeAgentFinishedEventName string = "upgrade_agent_finished" func NewUpgradeAgentFinishedEvent( - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, ) *UpgradeAgentFinishedEvent { - return &UpgradeAgentFinishedEvent{ - eventName: UpgradeAgentFinishedEventName, - HostId: hostId, - HostName: hostName, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - AgentImage: agentImage, - } + return &UpgradeAgentFinishedEvent{ + eventName: UpgradeAgentFinishedEventName, + HostId: hostId, + HostName: hostName, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + AgentImage: agentImage, + } } func SendUpgradeAgentFinishedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string,) { - ev := NewUpgradeAgentFinishedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string) { + ev := NewUpgradeAgentFinishedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendUpgradeAgentFinishedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, - eventTime time.Time) { - ev := NewUpgradeAgentFinishedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, + eventTime time.Time) { + ev := NewUpgradeAgentFinishedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *UpgradeAgentFinishedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *UpgradeAgentFinishedEvent) GetSeverity() string { - return "info" + return "info" } func (e *UpgradeAgentFinishedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *UpgradeAgentFinishedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *UpgradeAgentFinishedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *UpgradeAgentFinishedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{host_name}", fmt.Sprint(e.HostName), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{agent_image}", fmt.Sprint(e.AgentImage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{host_name}", fmt.Sprint(e.HostName), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{agent_image}", fmt.Sprint(e.AgentImage), + ) + return r.Replace(*message) } func (e *UpgradeAgentFinishedEvent) FormatMessage() string { - s := "Host {host_name}: Agent has downloaded image '{agent_image}' and will now restart" - return e.format(&s) + s := "Host {host_name}: Agent has downloaded image '{agent_image}' and will now restart" + return e.format(&s) } -// // Event upgrade_agent_failed -// type UpgradeAgentFailedEvent struct { - eventName string - HostId strfmt.UUID - HostName string - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - AgentImage string + eventName string + HostId strfmt.UUID + HostName string + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + AgentImage string } var UpgradeAgentFailedEventName string = "upgrade_agent_failed" func NewUpgradeAgentFailedEvent( - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, ) *UpgradeAgentFailedEvent { - return &UpgradeAgentFailedEvent{ - eventName: UpgradeAgentFailedEventName, - HostId: hostId, - HostName: hostName, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - AgentImage: agentImage, - } + return &UpgradeAgentFailedEvent{ + eventName: UpgradeAgentFailedEventName, + HostId: hostId, + HostName: hostName, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + AgentImage: agentImage, + } } func SendUpgradeAgentFailedEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string,) { - ev := NewUpgradeAgentFailedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string) { + ev := NewUpgradeAgentFailedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendUpgradeAgentFailedEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - hostName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - agentImage string, - eventTime time.Time) { - ev := NewUpgradeAgentFailedEvent( - hostId, - hostName, - infraEnvId, - clusterId, - agentImage, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + hostName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + agentImage string, + eventTime time.Time) { + ev := NewUpgradeAgentFailedEvent( + hostId, + hostName, + infraEnvId, + clusterId, + agentImage, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *UpgradeAgentFailedEvent) GetName() string { - return e.eventName + return e.eventName } func (e *UpgradeAgentFailedEvent) GetSeverity() string { - return "error" + return "error" } func (e *UpgradeAgentFailedEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *UpgradeAgentFailedEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *UpgradeAgentFailedEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *UpgradeAgentFailedEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{host_name}", fmt.Sprint(e.HostName), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{agent_image}", fmt.Sprint(e.AgentImage), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{host_name}", fmt.Sprint(e.HostName), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{agent_image}", fmt.Sprint(e.AgentImage), + ) + return r.Replace(*message) } func (e *UpgradeAgentFailedEvent) FormatMessage() string { - s := "Host {host_name}: Agent failed to download image '{agent_image}', will try again" - return e.format(&s) + s := "Host {host_name}: Agent failed to download image '{agent_image}', will try again" + return e.format(&s) } -// // Event validations_ignored -// type ValidationsIgnoredEvent struct { - eventName string - ClusterId strfmt.UUID + eventName string + ClusterId strfmt.UUID } var ValidationsIgnoredEventName string = "validations_ignored" func NewValidationsIgnoredEvent( - clusterId strfmt.UUID, + clusterId strfmt.UUID, ) *ValidationsIgnoredEvent { - return &ValidationsIgnoredEvent{ - eventName: ValidationsIgnoredEventName, - ClusterId: clusterId, - } + return &ValidationsIgnoredEvent{ + eventName: ValidationsIgnoredEventName, + ClusterId: clusterId, + } } func SendValidationsIgnoredEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID,) { - ev := NewValidationsIgnoredEvent( - clusterId, - ) - eventsHandler.SendClusterEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID) { + ev := NewValidationsIgnoredEvent( + clusterId, + ) + eventsHandler.SendClusterEvent(ctx, ev) } func SendValidationsIgnoredEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - clusterId strfmt.UUID, - eventTime time.Time) { - ev := NewValidationsIgnoredEvent( - clusterId, - ) - eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + clusterId strfmt.UUID, + eventTime time.Time) { + ev := NewValidationsIgnoredEvent( + clusterId, + ) + eventsHandler.SendClusterEventAtTime(ctx, ev, eventTime) } func (e *ValidationsIgnoredEvent) GetName() string { - return e.eventName + return e.eventName } func (e *ValidationsIgnoredEvent) GetSeverity() string { - return "info" + return "info" } func (e *ValidationsIgnoredEvent) GetClusterId() strfmt.UUID { - return e.ClusterId + return e.ClusterId } - - func (e *ValidationsIgnoredEvent) format(message *string) string { - r := strings.NewReplacer( - "{cluster_id}", fmt.Sprint(e.ClusterId), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{cluster_id}", fmt.Sprint(e.ClusterId), + ) + return r.Replace(*message) } func (e *ValidationsIgnoredEvent) FormatMessage() string { - s := "Cluster {cluster_id}: ignored some or all validations at the discretion of the user" - return e.format(&s) + s := "Cluster {cluster_id}: ignored some or all validations at the discretion of the user" + return e.format(&s) } -// // Event reboots_for_node -// type RebootsForNodeEvent struct { - eventName string - HostId strfmt.UUID - NodeName string - InfraEnvId strfmt.UUID - ClusterId *strfmt.UUID - Reboots int64 + eventName string + HostId strfmt.UUID + NodeName string + InfraEnvId strfmt.UUID + ClusterId *strfmt.UUID + Reboots int64 } var RebootsForNodeEventName string = "reboots_for_node" func NewRebootsForNodeEvent( - hostId strfmt.UUID, - nodeName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - reboots int64, + hostId strfmt.UUID, + nodeName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + reboots int64, ) *RebootsForNodeEvent { - return &RebootsForNodeEvent{ - eventName: RebootsForNodeEventName, - HostId: hostId, - NodeName: nodeName, - InfraEnvId: infraEnvId, - ClusterId: clusterId, - Reboots: reboots, - } + return &RebootsForNodeEvent{ + eventName: RebootsForNodeEventName, + HostId: hostId, + NodeName: nodeName, + InfraEnvId: infraEnvId, + ClusterId: clusterId, + Reboots: reboots, + } } func SendRebootsForNodeEvent( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - nodeName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - reboots int64,) { - ev := NewRebootsForNodeEvent( - hostId, - nodeName, - infraEnvId, - clusterId, - reboots, - ) - eventsHandler.SendHostEvent(ctx, ev) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + nodeName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + reboots int64) { + ev := NewRebootsForNodeEvent( + hostId, + nodeName, + infraEnvId, + clusterId, + reboots, + ) + eventsHandler.SendHostEvent(ctx, ev) } func SendRebootsForNodeEventAtTime( - ctx context.Context, - eventsHandler eventsapi.Sender, - hostId strfmt.UUID, - nodeName string, - infraEnvId strfmt.UUID, - clusterId *strfmt.UUID, - reboots int64, - eventTime time.Time) { - ev := NewRebootsForNodeEvent( - hostId, - nodeName, - infraEnvId, - clusterId, - reboots, - ) - eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) + ctx context.Context, + eventsHandler eventsapi.Sender, + hostId strfmt.UUID, + nodeName string, + infraEnvId strfmt.UUID, + clusterId *strfmt.UUID, + reboots int64, + eventTime time.Time) { + ev := NewRebootsForNodeEvent( + hostId, + nodeName, + infraEnvId, + clusterId, + reboots, + ) + eventsHandler.SendHostEventAtTime(ctx, ev, eventTime) } func (e *RebootsForNodeEvent) GetName() string { - return e.eventName + return e.eventName } func (e *RebootsForNodeEvent) GetSeverity() string { - return "info" + return "info" } func (e *RebootsForNodeEvent) GetClusterId() *strfmt.UUID { - return e.ClusterId + return e.ClusterId } func (e *RebootsForNodeEvent) GetHostId() strfmt.UUID { - return e.HostId + return e.HostId } func (e *RebootsForNodeEvent) GetInfraEnvId() strfmt.UUID { - return e.InfraEnvId + return e.InfraEnvId } - - func (e *RebootsForNodeEvent) format(message *string) string { - r := strings.NewReplacer( - "{host_id}", fmt.Sprint(e.HostId), - "{node_name}", fmt.Sprint(e.NodeName), - "{infra_env_id}", fmt.Sprint(e.InfraEnvId), - "{cluster_id}", fmt.Sprint(e.ClusterId), - "{reboots}", fmt.Sprint(e.Reboots), - ) - return r.Replace(*message) + r := strings.NewReplacer( + "{host_id}", fmt.Sprint(e.HostId), + "{node_name}", fmt.Sprint(e.NodeName), + "{infra_env_id}", fmt.Sprint(e.InfraEnvId), + "{cluster_id}", fmt.Sprint(e.ClusterId), + "{reboots}", fmt.Sprint(e.Reboots), + ) + return r.Replace(*message) } func (e *RebootsForNodeEvent) FormatMessage() string { - s := "Node {node_name} has been rebooted {reboots} times before completing installation" - return e.format(&s) + s := "Node {node_name} has been rebooted {reboots} times before completing installation" + return e.format(&s) } - diff --git a/internal/common/testing/dummies.go b/internal/common/testing/dummies.go index 493670541fa5..07fdcf98f5ea 100644 --- a/internal/common/testing/dummies.go +++ b/internal/common/testing/dummies.go @@ -1,8 +1,8 @@ package testing import ( - "github.com/golang/mock/gomock" "github.com/openshift/assisted-service/internal/stream" + "go.uber.org/mock/gomock" ) func GetDummyNotificationStream(ctrl *gomock.Controller) *stream.MockNotifier { diff --git a/internal/common/testing/matchers.go b/internal/common/testing/matchers.go index 1e773413ca8d..23f269fd6bd5 100644 --- a/internal/common/testing/matchers.go +++ b/internal/common/testing/matchers.go @@ -3,8 +3,8 @@ package testing import ( "fmt" - "github.com/golang/mock/gomock" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" ) type eqPlatformTypeMatcher struct { diff --git a/internal/connectivity/mock_connectivity_validator.go b/internal/connectivity/mock_connectivity_validator.go index 03fe07a3d024..81a1d64f20d6 100644 --- a/internal/connectivity/mock_connectivity_validator.go +++ b/internal/connectivity/mock_connectivity_validator.go @@ -7,8 +7,8 @@ package connectivity import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockValidator is a mock of Validator interface. diff --git a/internal/controller/controllers/agent_controller_test.go b/internal/controller/controllers/agent_controller_test.go index 60e2d7fe3eab..fbec31baf2a8 100644 --- a/internal/controller/controllers/agent_controller_test.go +++ b/internal/controller/controllers/agent_controller_test.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" bmh_v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo" @@ -32,6 +31,7 @@ import ( conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" hivev1 "github.com/openshift/hive/apis/hive/v1" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" appsv1 "k8s.io/api/apps/v1" certificatesv1 "k8s.io/api/certificates/v1" diff --git a/internal/controller/controllers/agentclassification_controller_test.go b/internal/controller/controllers/agentclassification_controller_test.go index 2ebbb2548d16..d457f70237e0 100644 --- a/internal/controller/controllers/agentclassification_controller_test.go +++ b/internal/controller/controllers/agentclassification_controller_test.go @@ -3,12 +3,12 @@ package controllers import ( "context" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/api/v1beta1" "github.com/openshift/assisted-service/internal/common" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" + "go.uber.org/mock/gomock" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" diff --git a/internal/controller/controllers/agentclusterinstall_controller_test.go b/internal/controller/controllers/agentclusterinstall_controller_test.go index f408fd778260..b89d9474c0f9 100644 --- a/internal/controller/controllers/agentclusterinstall_controller_test.go +++ b/internal/controller/controllers/agentclusterinstall_controller_test.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" hiveext "github.com/openshift/assisted-service/api/hiveextension/v1beta1" "github.com/openshift/assisted-service/internal/common" hivev1 "github.com/openshift/hive/apis/hive/v1" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" diff --git a/internal/controller/controllers/agentlabel_controller_test.go b/internal/controller/controllers/agentlabel_controller_test.go index 8c3abb1711bc..3da8754a0357 100644 --- a/internal/controller/controllers/agentlabel_controller_test.go +++ b/internal/controller/controllers/agentlabel_controller_test.go @@ -3,11 +3,11 @@ package controllers import ( "context" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/api/v1beta1" "github.com/openshift/assisted-service/internal/common" + "go.uber.org/mock/gomock" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" diff --git a/internal/controller/controllers/bmh_agent_controller_test.go b/internal/controller/controllers/bmh_agent_controller_test.go index 73c22d52a723..0c051f723276 100644 --- a/internal/controller/controllers/bmh_agent_controller_test.go +++ b/internal/controller/controllers/bmh_agent_controller_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" bmh_v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo" @@ -26,6 +25,7 @@ import ( "github.com/openshift/assisted-service/models" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" hivev1 "github.com/openshift/hive/apis/hive/v1" + "go.uber.org/mock/gomock" "gorm.io/gorm" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/internal/controller/controllers/bmo_utils_test.go b/internal/controller/controllers/bmo_utils_test.go index 0a672a5b8025..c607f42c9de4 100644 --- a/internal/controller/controllers/bmo_utils_test.go +++ b/internal/controller/controllers/bmo_utils_test.go @@ -3,13 +3,13 @@ package controllers import ( "context" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" v1 "github.com/openshift/api/config/v1" "github.com/openshift/assisted-service/internal/common" metal3iov1alpha1 "github.com/openshift/cluster-baremetal-operator/api/v1alpha1" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/internal/controller/controllers/clusterdeployments_controller_test.go b/internal/controller/controllers/clusterdeployments_controller_test.go index ce8b332ebc5f..b7e21571355b 100644 --- a/internal/controller/controllers/clusterdeployments_controller_test.go +++ b/internal/controller/controllers/clusterdeployments_controller_test.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -36,6 +35,7 @@ import ( hivev1 "github.com/openshift/hive/apis/hive/v1" "github.com/openshift/hive/apis/hive/v1/aws" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/internal/controller/controllers/controller_event_wrapper_test.go b/internal/controller/controllers/controller_event_wrapper_test.go index 6d750a8c68c9..eca7f2d7abdc 100644 --- a/internal/controller/controllers/controller_event_wrapper_test.go +++ b/internal/controller/controllers/controller_event_wrapper_test.go @@ -6,7 +6,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -18,6 +17,7 @@ import ( eventsapi "github.com/openshift/assisted-service/internal/events/api" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/controller/controllers/crd_utils_test.go b/internal/controller/controllers/crd_utils_test.go index c20354c94333..dd6471026dee 100644 --- a/internal/controller/controllers/crd_utils_test.go +++ b/internal/controller/controllers/crd_utils_test.go @@ -4,7 +4,6 @@ import ( "context" strfmt "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -13,6 +12,7 @@ import ( "github.com/openshift/assisted-service/internal/host" "github.com/openshift/assisted-service/models" hivev1 "github.com/openshift/hive/apis/hive/v1" + "go.uber.org/mock/gomock" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/internal/controller/controllers/gomock_reflect_2837856844/prog.go b/internal/controller/controllers/gomock_reflect_2837856844/prog.go deleted file mode 100644 index 51fa38d17936..000000000000 --- a/internal/controller/controllers/gomock_reflect_2837856844/prog.go +++ /dev/null @@ -1,63 +0,0 @@ -package main - -import ( - "encoding/gob" - "flag" - "fmt" - "os" - "path" - "reflect" - - "github.com/golang/mock/mockgen/model" - pkg_ "github.com/openshift/assisted-service/internal/controller/controllers" -) - -var output = flag.String("output", "", "The output file name, or empty to use stdout.") - -func main() { - flag.Parse() - - its := []struct { - sym string - typ reflect.Type - }{ - - {"K8sClient", reflect.TypeOf((*pkg_.K8sClient)(nil)).Elem()}, - } - pkg := &model.Package{ - // NOTE: This behaves contrary to documented behaviour if the - // package name is not the final component of the import path. - // The reflect package doesn't expose the package name, though. - Name: path.Base("github.com/openshift/assisted-service/internal/controller/controllers"), - } - - for _, it := range its { - intf, err := model.InterfaceFromInterfaceType(it.typ) - if err != nil { - fmt.Fprintf(os.Stderr, "Reflection: %v\n", err) - os.Exit(1) - } - intf.Name = it.sym - pkg.Interfaces = append(pkg.Interfaces, intf) - } - - outfile := os.Stdout - if len(*output) != 0 { - var err error - outfile, err = os.Create(*output) - if err != nil { - fmt.Fprintf(os.Stderr, "failed to open output file %q", *output) - } - defer func() { - if err := outfile.Close(); err != nil { - fmt.Fprintf(os.Stderr, "failed to close output file %q", *output) - os.Exit(1) - } - }() - } - - if err := gob.NewEncoder(outfile).Encode(pkg); err != nil { - fmt.Fprintf(os.Stderr, "gob encode: %v\n", err) - os.Exit(1) - } -} diff --git a/internal/controller/controllers/hypershiftagentserviceconfig_controller_test.go b/internal/controller/controllers/hypershiftagentserviceconfig_controller_test.go index aba116309c05..9888c82b7ec3 100644 --- a/internal/controller/controllers/hypershiftagentserviceconfig_controller_test.go +++ b/internal/controller/controllers/hypershiftagentserviceconfig_controller_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" routev1 "github.com/openshift/api/route/v1" @@ -14,6 +13,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" admregv1 "k8s.io/api/admissionregistration/v1" appsv1 "k8s.io/api/apps/v1" certificatesv1 "k8s.io/api/certificates/v1" diff --git a/internal/controller/controllers/infraenv_controller_test.go b/internal/controller/controllers/infraenv_controller_test.go index cb86c9a7946b..65e059791084 100644 --- a/internal/controller/controllers/infraenv_controller_test.go +++ b/internal/controller/controllers/infraenv_controller_test.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -27,6 +26,7 @@ import ( "github.com/openshift/assisted-service/restapi/operations/installer" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/internal/controller/controllers/mock_bmo_utils.go b/internal/controller/controllers/mock_bmo_utils.go index 7a992c5423fc..312063b5c5e2 100644 --- a/internal/controller/controllers/mock_bmo_utils.go +++ b/internal/controller/controllers/mock_bmo_utils.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockBMOUtils is a mock of BMOUtils interface. diff --git a/internal/controller/controllers/mock_crd_events_handler.go b/internal/controller/controllers/mock_crd_events_handler.go index e937aa020ad1..598a52cb955c 100644 --- a/internal/controller/controllers/mock_crd_events_handler.go +++ b/internal/controller/controllers/mock_crd_events_handler.go @@ -7,7 +7,7 @@ package controllers import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" event "sigs.k8s.io/controller-runtime/pkg/event" ) diff --git a/internal/controller/controllers/mock_drainer.go b/internal/controller/controllers/mock_drainer.go index 1e7043810075..213d286e7607 100644 --- a/internal/controller/controllers/mock_drainer.go +++ b/internal/controller/controllers/mock_drainer.go @@ -7,7 +7,7 @@ package controllers import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" v1 "k8s.io/api/core/v1" drain "k8s.io/kubectl/pkg/drain" ) diff --git a/internal/controller/controllers/mock_k8s_client.go b/internal/controller/controllers/mock_k8s_client.go index f7ff10e30c63..3c284aac5b9c 100644 --- a/internal/controller/controllers/mock_k8s_client.go +++ b/internal/controller/controllers/mock_k8s_client.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" meta "k8s.io/apimachinery/pkg/api/meta" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/internal/controller/controllers/mock_spoke_client_cache.go b/internal/controller/controllers/mock_spoke_client_cache.go index c0112bb3440e..cca6d0cb224e 100644 --- a/internal/controller/controllers/mock_spoke_client_cache.go +++ b/internal/controller/controllers/mock_spoke_client_cache.go @@ -7,9 +7,9 @@ package controllers import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" spoke_k8s_client "github.com/openshift/assisted-service/internal/spoke_k8s_client" v1 "github.com/openshift/hive/apis/hive/v1" + gomock "go.uber.org/mock/gomock" v10 "k8s.io/api/core/v1" ) diff --git a/internal/controller/controllers/mock_sub_resource_writer.go b/internal/controller/controllers/mock_sub_resource_writer.go index b5a0cab7c105..540b7900687a 100644 --- a/internal/controller/controllers/mock_sub_resource_writer.go +++ b/internal/controller/controllers/mock_sub_resource_writer.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" client "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/internal/controller/controllers/preprovisioningimage_controller_test.go b/internal/controller/controllers/preprovisioningimage_controller_test.go index 59b29cec43f3..7026f92bd61e 100644 --- a/internal/controller/controllers/preprovisioningimage_controller_test.go +++ b/internal/controller/controllers/preprovisioningimage_controller_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" metal3_v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo" @@ -23,6 +22,7 @@ import ( "github.com/openshift/assisted-service/restapi/operations/installer" conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" "github.com/pkg/errors" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" diff --git a/internal/controller/controllers/spoke_client_cache_test.go b/internal/controller/controllers/spoke_client_cache_test.go index 00bc95804504..ee52ce4817b2 100644 --- a/internal/controller/controllers/spoke_client_cache_test.go +++ b/internal/controller/controllers/spoke_client_cache_test.go @@ -3,10 +3,10 @@ package controllers import ( "errors" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/spoke_k8s_client" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/internal/dns/dns_test.go b/internal/dns/dns_test.go index 971929041680..8d61dc5d657b 100644 --- a/internal/dns/dns_test.go +++ b/internal/dns/dns_test.go @@ -6,13 +6,13 @@ import ( "testing" "github.com/danielerez/go-dns-client/pkg/dnsproviders" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/network" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) var _ = Describe("DNS tests", func() { diff --git a/internal/dns/mock_dns.go b/internal/dns/mock_dns.go index c8819a14ce58..3e4a1a84d48c 100644 --- a/internal/dns/mock_dns.go +++ b/internal/dns/mock_dns.go @@ -9,8 +9,8 @@ import ( reflect "reflect" dnsproviders "github.com/danielerez/go-dns-client/pkg/dnsproviders" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" + gomock "go.uber.org/mock/gomock" ) // MockDNSApi is a mock of DNSApi interface. diff --git a/internal/dns/mock_dns_vendor.go b/internal/dns/mock_dns_vendor.go deleted file mode 100644 index 6f115602fb03..000000000000 --- a/internal/dns/mock_dns_vendor.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: mocks.go - -// Package dns is a generated GoMock package. -package dns - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" -) - -// MockDNSProvider is a mock of DNSProvider interface. -type MockDNSProvider struct { - ctrl *gomock.Controller - recorder *MockDNSProviderMockRecorder -} - -// MockDNSProviderMockRecorder is the mock recorder for MockDNSProvider. -type MockDNSProviderMockRecorder struct { - mock *MockDNSProvider -} - -// NewMockDNSProvider creates a new mock instance. -func NewMockDNSProvider(ctrl *gomock.Controller) *MockDNSProvider { - mock := &MockDNSProvider{ctrl: ctrl} - mock.recorder = &MockDNSProviderMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDNSProvider) EXPECT() *MockDNSProviderMockRecorder { - return m.recorder -} - -// CreateRecordSet mocks base method. -func (m *MockDNSProvider) CreateRecordSet(recordSetName, recordSetValue string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateRecordSet", recordSetName, recordSetValue) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CreateRecordSet indicates an expected call of CreateRecordSet. -func (mr *MockDNSProviderMockRecorder) CreateRecordSet(recordSetName, recordSetValue interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRecordSet", reflect.TypeOf((*MockDNSProvider)(nil).CreateRecordSet), recordSetName, recordSetValue) -} - -// DeleteRecordSet mocks base method. -func (m *MockDNSProvider) DeleteRecordSet(recordSetName, recordSetValue string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteRecordSet", recordSetName, recordSetValue) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// DeleteRecordSet indicates an expected call of DeleteRecordSet. -func (mr *MockDNSProviderMockRecorder) DeleteRecordSet(recordSetName, recordSetValue interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRecordSet", reflect.TypeOf((*MockDNSProvider)(nil).DeleteRecordSet), recordSetName, recordSetValue) -} - -// GetDomainName mocks base method. -func (m *MockDNSProvider) GetDomainName() (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDomainName") - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetDomainName indicates an expected call of GetDomainName. -func (mr *MockDNSProviderMockRecorder) GetDomainName() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDomainName", reflect.TypeOf((*MockDNSProvider)(nil).GetDomainName)) -} - -// GetRecordSet mocks base method. -func (m *MockDNSProvider) GetRecordSet(recordSetName string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetRecordSet", recordSetName) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetRecordSet indicates an expected call of GetRecordSet. -func (mr *MockDNSProviderMockRecorder) GetRecordSet(recordSetName interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRecordSet", reflect.TypeOf((*MockDNSProvider)(nil).GetRecordSet), recordSetName) -} - -// UpdateRecordSet mocks base method. -func (m *MockDNSProvider) UpdateRecordSet(recordSetName, recordSetValue string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateRecordSet", recordSetName, recordSetValue) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// UpdateRecordSet indicates an expected call of UpdateRecordSet. -func (mr *MockDNSProviderMockRecorder) UpdateRecordSet(recordSetName, recordSetValue interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRecordSet", reflect.TypeOf((*MockDNSProvider)(nil).UpdateRecordSet), recordSetName, recordSetValue) -} diff --git a/internal/events/api/mock_event.go b/internal/events/api/mock_event.go index 9aa49d422c46..5003af9371e3 100644 --- a/internal/events/api/mock_event.go +++ b/internal/events/api/mock_event.go @@ -10,8 +10,8 @@ import ( time "time" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" + gomock "go.uber.org/mock/gomock" ) // MockSender is a mock of Sender interface. diff --git a/internal/events/event_test.go b/internal/events/event_test.go index a1c77b8882b4..82b67a22fbe5 100644 --- a/internal/events/event_test.go +++ b/internal/events/event_test.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -28,6 +27,7 @@ import ( "github.com/openshift/assisted-service/restapi/operations/events" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/hardware/mock_validator.go b/internal/hardware/mock_validator.go index f925fcc758a9..199e06536533 100644 --- a/internal/hardware/mock_validator.go +++ b/internal/hardware/mock_validator.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockValidator is a mock of Validator interface. diff --git a/internal/hardware/validator_test.go b/internal/hardware/validator_test.go index fcd5eaaa72b9..942b7a3491ff 100644 --- a/internal/hardware/validator_test.go +++ b/internal/hardware/validator_test.go @@ -14,7 +14,6 @@ import ( "github.com/alecthomas/units" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -27,6 +26,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "k8s.io/utils/ptr" ) diff --git a/internal/host/host_test.go b/internal/host/host_test.go index 7bc665a99fce..a663dfa3b371 100644 --- a/internal/host/host_test.go +++ b/internal/host/host_test.go @@ -14,7 +14,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -38,6 +37,7 @@ import ( "github.com/openshift/assisted-service/pkg/leader" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/host/hostcommands/connectivity_check_convertor_test.go b/internal/host/hostcommands/connectivity_check_convertor_test.go index 15e9d9cb0941..64f8df02a743 100644 --- a/internal/host/hostcommands/connectivity_check_convertor_test.go +++ b/internal/host/hostcommands/connectivity_check_convertor_test.go @@ -4,12 +4,12 @@ import ( "strings" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/connectivity" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" ) var _ = Describe("connectivitycheckconvertor", func() { diff --git a/internal/host/hostcommands/container_image_availability_cmd_test.go b/internal/host/hostcommands/container_image_availability_cmd_test.go index 2b0b21b76b39..1203754d0409 100644 --- a/internal/host/hostcommands/container_image_availability_cmd_test.go +++ b/internal/host/hostcommands/container_image_availability_cmd_test.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,6 +15,7 @@ import ( "github.com/openshift/assisted-service/internal/oc" "github.com/openshift/assisted-service/internal/versions" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/disk_performance_cmd_test.go b/internal/host/hostcommands/disk_performance_cmd_test.go index 6fe74bea6959..fcf75b62ad1d 100644 --- a/internal/host/hostcommands/disk_performance_cmd_test.go +++ b/internal/host/hostcommands/disk_performance_cmd_test.go @@ -5,7 +5,6 @@ import ( "encoding/json" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -13,6 +12,7 @@ import ( "github.com/openshift/assisted-service/internal/hardware" "github.com/openshift/assisted-service/internal/host/hostutil" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/domain_name_resolution_cmd_test.go b/internal/host/hostcommands/domain_name_resolution_cmd_test.go index 9fc1fc38aab2..daa366ad332d 100644 --- a/internal/host/hostcommands/domain_name_resolution_cmd_test.go +++ b/internal/host/hostcommands/domain_name_resolution_cmd_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,6 +15,7 @@ import ( "github.com/openshift/assisted-service/internal/host/hostutil" "github.com/openshift/assisted-service/internal/versions" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/download_boot_artifacts_cmd_test.go b/internal/host/hostcommands/download_boot_artifacts_cmd_test.go index f9197ab3dba9..bae7f84f3c46 100644 --- a/internal/host/hostcommands/download_boot_artifacts_cmd_test.go +++ b/internal/host/hostcommands/download_boot_artifacts_cmd_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -17,6 +16,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/auth" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/install_cmd_test.go b/internal/host/hostcommands/install_cmd_test.go index af5382bbfab8..883a0dd2b24a 100644 --- a/internal/host/hostcommands/install_cmd_test.go +++ b/internal/host/hostcommands/install_cmd_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -24,6 +23,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/pkg/errors" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/instruction_manager_test.go b/internal/host/hostcommands/instruction_manager_test.go index 2f3b5b7960e3..9c883c70b85c 100644 --- a/internal/host/hostcommands/instruction_manager_test.go +++ b/internal/host/hostcommands/instruction_manager_test.go @@ -9,7 +9,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -26,6 +25,7 @@ import ( "github.com/openshift/assisted-service/internal/versions" "github.com/openshift/assisted-service/models" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostcommands/mock_instruction_api.go b/internal/host/hostcommands/mock_instruction_api.go index 431089f3e55d..da0aff80132d 100644 --- a/internal/host/hostcommands/mock_instruction_api.go +++ b/internal/host/hostcommands/mock_instruction_api.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockInstructionApi is a mock of InstructionApi interface. diff --git a/internal/host/hostrole_test.go b/internal/host/hostrole_test.go index 23a66bd70563..dcd4882bf375 100644 --- a/internal/host/hostrole_test.go +++ b/internal/host/hostrole_test.go @@ -5,7 +5,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -22,6 +21,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/hostutil/update_host_test.go b/internal/host/hostutil/update_host_test.go index 4b91b841ebe9..b47639d868f8 100644 --- a/internal/host/hostutil/update_host_test.go +++ b/internal/host/hostutil/update_host_test.go @@ -5,7 +5,6 @@ import ( "fmt" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -15,6 +14,7 @@ import ( eventsapi "github.com/openshift/assisted-service/internal/events/api" "github.com/openshift/assisted-service/internal/events/eventstest" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/mock_host_api.go b/internal/host/mock_host_api.go index bb708caa8611..e996809360f7 100644 --- a/internal/host/mock_host_api.go +++ b/internal/host/mock_host_api.go @@ -9,10 +9,10 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" gorm "gorm.io/gorm" types "k8s.io/apimachinery/pkg/types" ) diff --git a/internal/host/mock_transition.go b/internal/host/mock_transition.go index f8721a16bb79..412ebe13f64d 100644 --- a/internal/host/mock_transition.go +++ b/internal/host/mock_transition.go @@ -9,7 +9,7 @@ import ( time "time" stateswitch "github.com/filanov/stateswitch" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockTransitionHandler is a mock of TransitionHandler interface. diff --git a/internal/host/monitor_test.go b/internal/host/monitor_test.go index 02fe973c29eb..f21b38506e87 100644 --- a/internal/host/monitor_test.go +++ b/internal/host/monitor_test.go @@ -6,7 +6,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -26,6 +25,7 @@ import ( "github.com/openshift/assisted-service/internal/versions" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/leader" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/refresh_status_preprocessor_test.go b/internal/host/refresh_status_preprocessor_test.go index 9ccb7f8f48d3..19c359548435 100644 --- a/internal/host/refresh_status_preprocessor_test.go +++ b/internal/host/refresh_status_preprocessor_test.go @@ -5,7 +5,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -19,6 +18,7 @@ import ( "github.com/openshift/assisted-service/pkg/s3wrapper" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/host/transition_test.go b/internal/host/transition_test.go index db671382b50f..c7ac47d64d05 100644 --- a/internal/host/transition_test.go +++ b/internal/host/transition_test.go @@ -13,7 +13,6 @@ import ( "github.com/filanov/stateswitch" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -36,6 +35,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" "k8s.io/utils/ptr" ) diff --git a/internal/host/validations_test.go b/internal/host/validations_test.go index 61525e3ff500..5aedf815bd94 100644 --- a/internal/host/validations_test.go +++ b/internal/host/validations_test.go @@ -9,7 +9,6 @@ import ( ignition_types "github.com/coreos/ignition/v2/config/v3_2/types" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -34,6 +33,7 @@ import ( "github.com/openshift/assisted-service/pkg/s3wrapper" "github.com/samber/lo" "github.com/vincent-petithory/dataurl" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/ignition/disconnected_test.go b/internal/ignition/disconnected_test.go index 5568ff969066..a5e3d432f3d4 100644 --- a/internal/ignition/disconnected_test.go +++ b/internal/ignition/disconnected_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/api/v1beta1" @@ -21,6 +20,7 @@ import ( "github.com/openshift/assisted-service/pkg/mirrorregistries" "github.com/pkg/errors" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gopkg.in/yaml.v2" corev1 "k8s.io/api/core/v1" ) diff --git a/internal/ignition/discovery_test.go b/internal/ignition/discovery_test.go index 8e14a88f6b46..3822b84ad1e1 100644 --- a/internal/ignition/discovery_test.go +++ b/internal/ignition/discovery_test.go @@ -14,7 +14,6 @@ import ( config_32 "github.com/coreos/ignition/v2/config/v3_2" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -30,6 +29,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/vincent-petithory/dataurl" + "go.uber.org/mock/gomock" ) var _ = Describe("proxySettingsForIgnition", func() { diff --git a/internal/ignition/installmanifests_test.go b/internal/ignition/installmanifests_test.go index 687e79d9fe62..62c2b4affc33 100644 --- a/internal/ignition/installmanifests_test.go +++ b/internal/ignition/installmanifests_test.go @@ -16,7 +16,6 @@ import ( config_32_types "github.com/coreos/ignition/v2/config/v3_2/types" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" bmh_v1alpha1 "github.com/metal3-io/baremetal-operator/apis/metal3.io/v1alpha1" . "github.com/onsi/ginkgo" @@ -34,6 +33,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/s3wrapper" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gopkg.in/yaml.v2" "gorm.io/gorm" ) diff --git a/internal/ignition/mock_ignition_builder.go b/internal/ignition/mock_ignition_builder.go index 0b5442bfda1c..685796c7e027 100644 --- a/internal/ignition/mock_ignition_builder.go +++ b/internal/ignition/mock_ignition_builder.go @@ -8,10 +8,10 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" auth "github.com/openshift/assisted-service/pkg/auth" + gomock "go.uber.org/mock/gomock" ) // MockIgnitionBuilder is a mock of IgnitionBuilder interface. diff --git a/internal/infraenv/infraenv_test.go b/internal/infraenv/infraenv_test.go index a00f5ab975da..2b9b17d66914 100644 --- a/internal/infraenv/infraenv_test.go +++ b/internal/infraenv/infraenv_test.go @@ -6,7 +6,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -14,6 +13,7 @@ import ( "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/s3wrapper" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/infraenv/mock_infraenv_api.go b/internal/infraenv/mock_infraenv_api.go index 55406bd94c19..890b0af0eff7 100644 --- a/internal/infraenv/mock_infraenv_api.go +++ b/internal/infraenv/mock_infraenv_api.go @@ -9,7 +9,7 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. diff --git a/internal/installcfg/builder/builder_test.go b/internal/installcfg/builder/builder_test.go index 349b83ff5284..4e4f1119f44e 100644 --- a/internal/installcfg/builder/builder_test.go +++ b/internal/installcfg/builder/builder_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -22,6 +21,7 @@ import ( "github.com/openshift/assisted-service/internal/provider/registry" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/mirrorregistries" + "go.uber.org/mock/gomock" ) var ( diff --git a/internal/installcfg/builder/mock_installcfg.go b/internal/installcfg/builder/mock_installcfg.go index ce8cf10fa672..9653d3dad13c 100644 --- a/internal/installcfg/builder/mock_installcfg.go +++ b/internal/installcfg/builder/mock_installcfg.go @@ -7,8 +7,8 @@ package builder import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" + gomock "go.uber.org/mock/gomock" ) // MockInstallConfigBuilder is a mock of InstallConfigBuilder interface. diff --git a/internal/installercache/installercache_test.go b/internal/installercache/installercache_test.go index 691448547182..7eac67b13e01 100644 --- a/internal/installercache/installercache_test.go +++ b/internal/installercache/installercache_test.go @@ -14,7 +14,6 @@ import ( "time" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -23,6 +22,7 @@ import ( "github.com/openshift/assisted-service/internal/oc" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) var _ = Describe("release event", func() { diff --git a/internal/installercache/mock_installercache.go b/internal/installercache/mock_installercache.go index 09abfe5b0b48..1b776967f434 100644 --- a/internal/installercache/mock_installercache.go +++ b/internal/installercache/mock_installercache.go @@ -9,8 +9,8 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" oc "github.com/openshift/assisted-service/internal/oc" + gomock "go.uber.org/mock/gomock" ) // MockInstallerCache is a mock of InstallerCache interface. diff --git a/internal/manifests/api/mock_manifests_api.go b/internal/manifests/api/mock_manifests_api.go index 600a89bdd1f9..0d1a70312bc3 100644 --- a/internal/manifests/api/mock_manifests_api.go +++ b/internal/manifests/api/mock_manifests_api.go @@ -10,9 +10,9 @@ import ( middleware "github.com/go-openapi/runtime/middleware" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" manifests "github.com/openshift/assisted-service/restapi/operations/manifests" + gomock "go.uber.org/mock/gomock" ) // MockManifestsAPI is a mock of ManifestsAPI interface. diff --git a/internal/manifests/api/mock_manifests_internal.go b/internal/manifests/api/mock_manifests_internal.go index 32b077e15c45..ebeab5a23557 100644 --- a/internal/manifests/api/mock_manifests_internal.go +++ b/internal/manifests/api/mock_manifests_internal.go @@ -9,9 +9,9 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" manifests "github.com/openshift/assisted-service/restapi/operations/manifests" + gomock "go.uber.org/mock/gomock" ) // MockClusterManifestsInternals is a mock of ClusterManifestsInternals interface. diff --git a/internal/manifests/manifests_test.go b/internal/manifests/manifests_test.go index b25b97abc813..64c823e3a13e 100644 --- a/internal/manifests/manifests_test.go +++ b/internal/manifests/manifests_test.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -25,6 +24,7 @@ import ( "github.com/openshift/assisted-service/pkg/filemiddleware" "github.com/openshift/assisted-service/pkg/s3wrapper" operations "github.com/openshift/assisted-service/restapi/operations/manifests" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/metrics/directory_usage_collector_test.go b/internal/metrics/directory_usage_collector_test.go index c6aec700cf8a..72f2205c2557 100644 --- a/internal/metrics/directory_usage_collector_test.go +++ b/internal/metrics/directory_usage_collector_test.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) var _ = Describe("Collection on scrape", func() { diff --git a/internal/metrics/metricsManager_test.go b/internal/metrics/metricsManager_test.go index 085cf2df932a..fd10a42a17da 100644 --- a/internal/metrics/metricsManager_test.go +++ b/internal/metrics/metricsManager_test.go @@ -5,13 +5,13 @@ import ( "time" "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" eventsapi "github.com/openshift/assisted-service/internal/events/api" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) var _ = DescribeTable( diff --git a/internal/metrics/mock_disk_stats_helper.go b/internal/metrics/mock_disk_stats_helper.go index a271362cda41..441f09426347 100644 --- a/internal/metrics/mock_disk_stats_helper.go +++ b/internal/metrics/mock_disk_stats_helper.go @@ -7,7 +7,7 @@ package metrics import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockDiskStatsHelper is a mock of DiskStatsHelper interface. diff --git a/internal/metrics/mock_metrics_manager_api.go b/internal/metrics/mock_metrics_manager_api.go index d25b129bddd8..bef3b7af73dd 100644 --- a/internal/metrics/mock_metrics_manager_api.go +++ b/internal/metrics/mock_metrics_manager_api.go @@ -10,8 +10,8 @@ import ( time "time" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. diff --git a/internal/network/manifests_generator_test.go b/internal/network/manifests_generator_test.go index 7c27e6dd5955..1d0f729f3a30 100644 --- a/internal/network/manifests_generator_test.go +++ b/internal/network/manifests_generator_test.go @@ -10,7 +10,6 @@ import ( configv31 "github.com/coreos/ignition/v2/config/v3_1" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -22,6 +21,7 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/vincent-petithory/dataurl" + "go.uber.org/mock/gomock" "gorm.io/gorm" "sigs.k8s.io/yaml" ) diff --git a/internal/network/mock_manifests_generator.go b/internal/network/mock_manifests_generator.go index 306c17fc9230..e7db19518e1c 100644 --- a/internal/network/mock_manifests_generator.go +++ b/internal/network/mock_manifests_generator.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) // MockManifestsGeneratorAPI is a mock of ManifestsGeneratorAPI interface. diff --git a/internal/oc/mock_release.go b/internal/oc/mock_release.go index 26decb869156..a07809548ff2 100644 --- a/internal/oc/mock_release.go +++ b/internal/oc/mock_release.go @@ -7,8 +7,8 @@ package oc import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) // MockRelease is a mock of Release interface. diff --git a/internal/oc/release_test.go b/internal/oc/release_test.go index 5b59f60222e0..4eda2d32e008 100644 --- a/internal/oc/release_test.go +++ b/internal/oc/release_test.go @@ -9,7 +9,6 @@ import ( "testing" "time" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" @@ -18,6 +17,7 @@ import ( "github.com/openshift/assisted-service/pkg/executer" "github.com/openshift/assisted-service/pkg/mirrorregistries" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) var ( diff --git a/internal/operators/api/mock_operator_api.go b/internal/operators/api/mock_operator_api.go index bedad3458691..3b881cacf980 100644 --- a/internal/operators/api/mock_operator_api.go +++ b/internal/operators/api/mock_operator_api.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockOperator is a mock of Operator interface. diff --git a/internal/operators/builder_test.go b/internal/operators/builder_test.go index 559532a1584d..b3c336e50de6 100644 --- a/internal/operators/builder_test.go +++ b/internal/operators/builder_test.go @@ -1,12 +1,12 @@ package operators import ( - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/operators/api" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) var _ = Describe("Operators manager builder", func() { diff --git a/internal/operators/handler/handler_test.go b/internal/operators/handler/handler_test.go index 03670fc973d4..3b920bb04639 100644 --- a/internal/operators/handler/handler_test.go +++ b/internal/operators/handler/handler_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -24,6 +23,7 @@ import ( "github.com/openshift/assisted-service/models" restoperators "github.com/openshift/assisted-service/restapi/operations/operators" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/operators/lvm/lvm_operator_test.go b/internal/operators/lvm/lvm_operator_test.go index c6116bd8f23b..1731c06b37c1 100644 --- a/internal/operators/lvm/lvm_operator_test.go +++ b/internal/operators/lvm/lvm_operator_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" "github.com/onsi/ginkgo/extensions/table" @@ -27,6 +26,7 @@ import ( "github.com/openshift/assisted-service/internal/versions" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/operators/manager_test.go b/internal/operators/manager_test.go index 5643758f94cb..835582f5435b 100644 --- a/internal/operators/manager_test.go +++ b/internal/operators/manager_test.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -50,6 +49,7 @@ import ( "github.com/openshift/assisted-service/pkg/s3wrapper" operations "github.com/openshift/assisted-service/restapi/operations/manifests" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" "sigs.k8s.io/yaml" ) diff --git a/internal/operators/mock_operators_api.go b/internal/operators/mock_operators_api.go index 97377b345552..1fda80d72c3c 100644 --- a/internal/operators/mock_operators_api.go +++ b/internal/operators/mock_operators_api.go @@ -8,11 +8,11 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" featuresupport "github.com/openshift/assisted-service/internal/featuresupport" api "github.com/openshift/assisted-service/internal/operators/api" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. diff --git a/internal/operators/odf/validation_test.go b/internal/operators/odf/validation_test.go index b0cdf5f3b329..1b5060987eb8 100644 --- a/internal/operators/odf/validation_test.go +++ b/internal/operators/odf/validation_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/kelseyhightower/envconfig" . "github.com/onsi/ginkgo" @@ -23,6 +22,7 @@ import ( "github.com/openshift/assisted-service/internal/testing" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/operators/openshiftai/mock_gpu_vendor.go b/internal/operators/openshiftai/mock_gpu_vendor.go deleted file mode 100644 index 1b3110d9ea24..000000000000 --- a/internal/operators/openshiftai/mock_gpu_vendor.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/openshift/assisted-service/internal/operators/openshiftai (interfaces: GPUVendor) - -// Package openshiftai is a generated GoMock package. -package openshiftai - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - common "github.com/openshift/assisted-service/internal/common" - models "github.com/openshift/assisted-service/models" -) - -// MockGPUVendor is a mock of GPUVendor interface. -type MockGPUVendor struct { - ctrl *gomock.Controller - recorder *MockGPUVendorMockRecorder -} - -// MockGPUVendorMockRecorder is the mock recorder for MockGPUVendor. -type MockGPUVendorMockRecorder struct { - mock *MockGPUVendor -} - -// NewMockGPUVendor creates a new mock instance. -func NewMockGPUVendor(ctrl *gomock.Controller) *MockGPUVendor { - mock := &MockGPUVendor{ctrl: ctrl} - mock.recorder = &MockGPUVendorMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockGPUVendor) EXPECT() *MockGPUVendorMockRecorder { - return m.recorder -} - -// ClusterHasGPU mocks base method. -func (m *MockGPUVendor) ClusterHasGPU(arg0 *common.Cluster) (bool, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ClusterHasGPU", arg0) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ClusterHasGPU indicates an expected call of ClusterHasGPU. -func (mr *MockGPUVendorMockRecorder) ClusterHasGPU(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterHasGPU", reflect.TypeOf((*MockGPUVendor)(nil).ClusterHasGPU), arg0) -} - -// GetFeatureSupportID mocks base method. -func (m *MockGPUVendor) GetFeatureSupportID() models.FeatureSupportLevelID { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetFeatureSupportID") - ret0, _ := ret[0].(models.FeatureSupportLevelID) - return ret0 -} - -// GetFeatureSupportID indicates an expected call of GetFeatureSupportID. -func (mr *MockGPUVendorMockRecorder) GetFeatureSupportID() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFeatureSupportID", reflect.TypeOf((*MockGPUVendor)(nil).GetFeatureSupportID)) -} - -// GetName mocks base method. -func (m *MockGPUVendor) GetName() string { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetName") - ret0, _ := ret[0].(string) - return ret0 -} - -// GetName indicates an expected call of GetName. -func (mr *MockGPUVendorMockRecorder) GetName() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetName", reflect.TypeOf((*MockGPUVendor)(nil).GetName)) -} diff --git a/internal/operators/openshiftai/openshift_ai_operator_test.go b/internal/operators/openshiftai/openshift_ai_operator_test.go index 432619f2343e..d1d0955b168b 100644 --- a/internal/operators/openshiftai/openshift_ai_operator_test.go +++ b/internal/operators/openshiftai/openshift_ai_operator_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" @@ -12,6 +11,7 @@ import ( "github.com/openshift/assisted-service/internal/operators/api" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/conversions" + "go.uber.org/mock/gomock" ) var _ = Describe("Operator", func() { diff --git a/internal/provider/mock_base_provider.go b/internal/provider/mock_base_provider.go index fad581088b19..25b4ac90d3ca 100644 --- a/internal/provider/mock_base_provider.go +++ b/internal/provider/mock_base_provider.go @@ -7,11 +7,11 @@ package provider import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" installcfg "github.com/openshift/assisted-service/internal/installcfg" usage "github.com/openshift/assisted-service/internal/usage" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockProvider is a mock of Provider interface. diff --git a/internal/provider/registry/mock_providerregistry.go b/internal/provider/registry/mock_providerregistry.go index f2c5990797ae..a11d6256da46 100644 --- a/internal/provider/registry/mock_providerregistry.go +++ b/internal/provider/registry/mock_providerregistry.go @@ -7,12 +7,12 @@ package registry import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" installcfg "github.com/openshift/assisted-service/internal/installcfg" provider "github.com/openshift/assisted-service/internal/provider" usage "github.com/openshift/assisted-service/internal/usage" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockProviderRegistry is a mock of ProviderRegistry interface. diff --git a/internal/provider/registry/mock_registry.go b/internal/provider/registry/mock_registry.go index 02d52e3a977d..1098e132b407 100644 --- a/internal/provider/registry/mock_registry.go +++ b/internal/provider/registry/mock_registry.go @@ -7,9 +7,9 @@ package registry import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" provider "github.com/openshift/assisted-service/internal/provider" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockRegistry is a mock of Registry interface. diff --git a/internal/provider/registry/registry_test.go b/internal/provider/registry/registry_test.go index e2ec8362a5bb..0cc0629dc1ad 100644 --- a/internal/provider/registry/registry_test.go +++ b/internal/provider/registry/registry_test.go @@ -7,7 +7,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,6 +15,7 @@ import ( "github.com/openshift/assisted-service/internal/provider/vsphere" "github.com/openshift/assisted-service/internal/usage" "github.com/openshift/assisted-service/models" + "go.uber.org/mock/gomock" ) var ( diff --git a/internal/releasesources/mock_clients.go b/internal/releasesources/mock_clients.go index 62d66ed666ba..f6ed00ec56ad 100644 --- a/internal/releasesources/mock_clients.go +++ b/internal/releasesources/mock_clients.go @@ -7,8 +7,8 @@ package releasesources import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockopenShiftReleasesAPIClientInterface is a mock of openShiftReleasesAPIClientInterface interface. diff --git a/internal/releasesources/release_sources_test.go b/internal/releasesources/release_sources_test.go index 5c2f39e7ebac..c9e73fec9f38 100644 --- a/internal/releasesources/release_sources_test.go +++ b/internal/releasesources/release_sources_test.go @@ -4,12 +4,12 @@ import ( "testing" "github.com/go-openapi/swag" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/models" "github.com/openshift/assisted-service/pkg/leader" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/spoke_k8s_client/factory_test.go b/internal/spoke_k8s_client/factory_test.go index e93ab9889d9d..3c7b42485c7b 100644 --- a/internal/spoke_k8s_client/factory_test.go +++ b/internal/spoke_k8s_client/factory_test.go @@ -3,7 +3,6 @@ package spoke_k8s_client import ( "net/http" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" . "github.com/onsi/gomega" @@ -12,6 +11,7 @@ import ( "github.com/openshift/assisted-service/internal/system" hivev1 "github.com/openshift/hive/apis/hive/v1" "github.com/pkg/errors" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/internal/spoke_k8s_client/gomock_reflect_3544310690/prog.go b/internal/spoke_k8s_client/gomock_reflect_3544310690/prog.go deleted file mode 100644 index 2ddfa7cb2af9..000000000000 --- a/internal/spoke_k8s_client/gomock_reflect_3544310690/prog.go +++ /dev/null @@ -1,66 +0,0 @@ - -package main - -import ( - "encoding/gob" - "flag" - "fmt" - "os" - "path" - "reflect" - - "github.com/golang/mock/mockgen/model" - - pkg_ "github.com/openshift/assisted-service/internal/spoke_k8s_client" -) - -var output = flag.String("output", "", "The output file name, or empty to use stdout.") - -func main() { - flag.Parse() - - its := []struct{ - sym string - typ reflect.Type - }{ - - { "SpokeK8sClientFactory", reflect.TypeOf((*pkg_.SpokeK8sClientFactory)(nil)).Elem()}, - - } - pkg := &model.Package{ - // NOTE: This behaves contrary to documented behaviour if the - // package name is not the final component of the import path. - // The reflect package doesn't expose the package name, though. - Name: path.Base("github.com/openshift/assisted-service/internal/spoke_k8s_client"), - } - - for _, it := range its { - intf, err := model.InterfaceFromInterfaceType(it.typ) - if err != nil { - fmt.Fprintf(os.Stderr, "Reflection: %v\n", err) - os.Exit(1) - } - intf.Name = it.sym - pkg.Interfaces = append(pkg.Interfaces, intf) - } - - outfile := os.Stdout - if len(*output) != 0 { - var err error - outfile, err = os.Create(*output) - if err != nil { - fmt.Fprintf(os.Stderr, "failed to open output file %q", *output) - } - defer func() { - if err := outfile.Close(); err != nil { - fmt.Fprintf(os.Stderr, "failed to close output file %q", *output) - os.Exit(1) - } - }() - } - - if err := gob.NewEncoder(outfile).Encode(pkg); err != nil { - fmt.Fprintf(os.Stderr, "gob encode: %v\n", err) - os.Exit(1) - } -} diff --git a/internal/spoke_k8s_client/mock_spoke_k8s_client.go b/internal/spoke_k8s_client/mock_spoke_k8s_client.go index 5d9c767bb950..cb044c3b792d 100644 --- a/internal/spoke_k8s_client/mock_spoke_k8s_client.go +++ b/internal/spoke_k8s_client/mock_spoke_k8s_client.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" v1 "k8s.io/api/certificates/v1" v10 "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/api/meta" diff --git a/internal/spoke_k8s_client/mock_spoke_k8s_client_factory.go b/internal/spoke_k8s_client/mock_spoke_k8s_client_factory.go index 2e5e46387513..12127de76212 100644 --- a/internal/spoke_k8s_client/mock_spoke_k8s_client_factory.go +++ b/internal/spoke_k8s_client/mock_spoke_k8s_client_factory.go @@ -7,8 +7,8 @@ package spoke_k8s_client import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" v1 "github.com/openshift/hive/apis/hive/v1" + gomock "go.uber.org/mock/gomock" v10 "k8s.io/api/core/v1" kubernetes "k8s.io/client-go/kubernetes" ) diff --git a/internal/stream/mock_notification_stream.go b/internal/stream/mock_notification_stream.go index 2fd78b4bbe3e..2206c61ada08 100644 --- a/internal/stream/mock_notification_stream.go +++ b/internal/stream/mock_notification_stream.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" + gomock "go.uber.org/mock/gomock" ) // MockNotifier is a mock of Notifier interface. diff --git a/internal/stream/mock_writer.go b/internal/stream/mock_writer.go index 023c4673bfd0..84f5e2160579 100644 --- a/internal/stream/mock_writer.go +++ b/internal/stream/mock_writer.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockStreamWriter is a mock of StreamWriter interface. diff --git a/internal/stream/notification_stream_test.go b/internal/stream/notification_stream_test.go index f77a565bcc40..ee77df439f73 100644 --- a/internal/stream/notification_stream_test.go +++ b/internal/stream/notification_stream_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -15,6 +14,7 @@ import ( "github.com/openshift/assisted-service/internal/stream" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) var _ = Describe("Close", func() { diff --git a/internal/system/mock_system.go b/internal/system/mock_system.go index e837247d7755..905e680875fb 100644 --- a/internal/system/mock_system.go +++ b/internal/system/mock_system.go @@ -7,7 +7,7 @@ package system import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockSystemInfo is a mock of SystemInfo interface. diff --git a/internal/uploader/auth_utils_test.go b/internal/uploader/auth_utils_test.go index add7cd91429e..a140cd0016e8 100644 --- a/internal/uploader/auth_utils_test.go +++ b/internal/uploader/auth_utils_test.go @@ -4,10 +4,10 @@ import ( "encoding/base64" "fmt" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/pkg/k8sclient" + "go.uber.org/mock/gomock" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/internal/uploader/events_uploader_test.go b/internal/uploader/events_uploader_test.go index e6e2da30ae03..a14956905804 100644 --- a/internal/uploader/events_uploader_test.go +++ b/internal/uploader/events_uploader_test.go @@ -17,7 +17,6 @@ import ( "time" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -31,6 +30,7 @@ import ( "github.com/openshift/assisted-service/pkg/k8sclient" eventModels "github.com/openshift/assisted-service/pkg/uploader/models" "github.com/pkg/errors" + "go.uber.org/mock/gomock" "gorm.io/gorm" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" diff --git a/internal/uploader/mock_uploader.go b/internal/uploader/mock_uploader.go index 3056ac98b62d..2559ccf7bf5f 100644 --- a/internal/uploader/mock_uploader.go +++ b/internal/uploader/mock_uploader.go @@ -8,9 +8,9 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" api "github.com/openshift/assisted-service/internal/events/api" + gomock "go.uber.org/mock/gomock" ) // MockClient is a mock of Client interface. diff --git a/internal/usage/manager_test.go b/internal/usage/manager_test.go index 8b0823fc6038..97cfa9439a7d 100644 --- a/internal/usage/manager_test.go +++ b/internal/usage/manager_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -12,6 +11,7 @@ import ( commontesting "github.com/openshift/assisted-service/internal/common/testing" "github.com/openshift/assisted-service/models" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/usage/mock_usage_manager.go b/internal/usage/mock_usage_manager.go index 4664851cecd0..9306afebef6d 100644 --- a/internal/usage/mock_usage_manager.go +++ b/internal/usage/mock_usage_manager.go @@ -8,7 +8,7 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" gorm "gorm.io/gorm" ) diff --git a/internal/versions/api_test.go b/internal/versions/api_test.go index ba3b9292a1e8..314dd4407f89 100644 --- a/internal/versions/api_test.go +++ b/internal/versions/api_test.go @@ -6,7 +6,6 @@ import ( "os" "github.com/go-openapi/swag" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" @@ -16,6 +15,7 @@ import ( "github.com/openshift/assisted-service/pkg/ocm" "github.com/openshift/assisted-service/restapi" operations "github.com/openshift/assisted-service/restapi/operations/versions" + gomock "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/internal/versions/common_test.go b/internal/versions/common_test.go index c72ce46d796b..4fa69785b591 100644 --- a/internal/versions/common_test.go +++ b/internal/versions/common_test.go @@ -7,13 +7,13 @@ import ( "sync" "github.com/go-openapi/swag" - gomock "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/common" "github.com/openshift/assisted-service/internal/oc" models "github.com/openshift/assisted-service/models" "github.com/pkg/errors" + gomock "go.uber.org/mock/gomock" ) var _ = Describe("NewHandler", func() { diff --git a/internal/versions/kube_api_versions_test.go b/internal/versions/kube_api_versions_test.go index 294c243c91bf..9d7c8f591af3 100644 --- a/internal/versions/kube_api_versions_test.go +++ b/internal/versions/kube_api_versions_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/go-openapi/swag" - gomock "github.com/golang/mock/gomock" "github.com/lib/pq" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -15,6 +14,7 @@ import ( hivev1 "github.com/openshift/hive/apis/hive/v1" "github.com/pkg/errors" "github.com/thoas/go-funk" + gomock "go.uber.org/mock/gomock" "golang.org/x/sync/semaphore" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/internal/versions/mock_osimages.go b/internal/versions/mock_osimages.go index ccf6e40ff51c..8aaf83ff8ea1 100644 --- a/internal/versions/mock_osimages.go +++ b/internal/versions/mock_osimages.go @@ -7,8 +7,8 @@ package versions import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockOSImages is a mock of OSImages interface. diff --git a/internal/versions/mock_versions.go b/internal/versions/mock_versions.go index 2f9da3a7505f..39ec4248c40b 100644 --- a/internal/versions/mock_versions.go +++ b/internal/versions/mock_versions.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockHandler is a mock of Handler interface. diff --git a/mocks/mock_assisted_service.go b/mocks/mock_assisted_service.go index c45a7f3be17f..f21741b28d41 100644 --- a/mocks/mock_assisted_service.go +++ b/mocks/mock_assisted_service.go @@ -9,8 +9,8 @@ import ( reflect "reflect" middleware "github.com/go-openapi/runtime/middleware" - gomock "github.com/golang/mock/gomock" installer "github.com/openshift/assisted-service/restapi/operations/installer" + gomock "go.uber.org/mock/gomock" ) // MockInstallerAPI is a mock of InstallerAPI interface. diff --git a/mocks/mock_manifests.go b/mocks/mock_manifests.go index f9383b38c1eb..b9081fe97775 100644 --- a/mocks/mock_manifests.go +++ b/mocks/mock_manifests.go @@ -9,8 +9,8 @@ import ( reflect "reflect" middleware "github.com/go-openapi/runtime/middleware" - gomock "github.com/golang/mock/gomock" manifests "github.com/openshift/assisted-service/restapi/operations/manifests" + gomock "go.uber.org/mock/gomock" ) // MockManifestsAPI is a mock of ManifestsAPI interface. diff --git a/pkg/auth/rhsso_authenticator_test.go b/pkg/auth/rhsso_authenticator_test.go index 97b9d812a8a7..6f30540ac272 100644 --- a/pkg/auth/rhsso_authenticator_test.go +++ b/pkg/auth/rhsso_authenticator_test.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" "github.com/golang-jwt/jwt/v4" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -26,6 +25,7 @@ import ( "github.com/patrickmn/go-cache" "github.com/pkg/errors" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/pkg/auth/rhsso_authz_handler_test.go b/pkg/auth/rhsso_authz_handler_test.go index e19dac06532c..33dcca4ddda2 100644 --- a/pkg/auth/rhsso_authz_handler_test.go +++ b/pkg/auth/rhsso_authz_handler_test.go @@ -16,7 +16,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/golang-jwt/jwt/v4" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -34,6 +33,7 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "github.com/thoas/go-funk" + "go.uber.org/mock/gomock" "gorm.io/gorm" ) diff --git a/pkg/executer/mock_executer.go b/pkg/executer/mock_executer.go index 939bf26fafd4..e5f2479e1fff 100644 --- a/pkg/executer/mock_executer.go +++ b/pkg/executer/mock_executer.go @@ -9,7 +9,7 @@ import ( os "os" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockExecuter is a mock of Executer interface. diff --git a/pkg/generator/mock_install_config.go b/pkg/generator/mock_install_config.go index 69b44356f46d..9c87a8a1a6f8 100644 --- a/pkg/generator/mock_install_config.go +++ b/pkg/generator/mock_install_config.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" common "github.com/openshift/assisted-service/internal/common" + gomock "go.uber.org/mock/gomock" ) // MockInstallConfigGenerator is a mock of InstallConfigGenerator interface. diff --git a/pkg/k8sclient/mock_k8sclient.go b/pkg/k8sclient/mock_k8sclient.go index 2d75b4e714a9..a8f683db1be6 100644 --- a/pkg/k8sclient/mock_k8sclient.go +++ b/pkg/k8sclient/mock_k8sclient.go @@ -7,8 +7,8 @@ package k8sclient import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" v1 "github.com/openshift/api/config/v1" + gomock "go.uber.org/mock/gomock" v10 "k8s.io/api/core/v1" ) diff --git a/pkg/kafka/json_writer_test.go b/pkg/kafka/json_writer_test.go index 2f197b2f7410..b5467e19d875 100644 --- a/pkg/kafka/json_writer_test.go +++ b/pkg/kafka/json_writer_test.go @@ -6,10 +6,10 @@ import ( "errors" "testing" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" kafka "github.com/segmentio/kafka-go" + "go.uber.org/mock/gomock" ) type InvalidJSON struct { diff --git a/pkg/kafka/mock_json_writer.go b/pkg/kafka/mock_json_writer.go index 7c42d42c5544..83ffcbd6363f 100644 --- a/pkg/kafka/mock_json_writer.go +++ b/pkg/kafka/mock_json_writer.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" kafka "github.com/segmentio/kafka-go" + gomock "go.uber.org/mock/gomock" ) // MockProducer is a mock of Producer interface. diff --git a/pkg/leader/mock_leader_elector.go b/pkg/leader/mock_leader_elector.go index 2dbf5bcc43f2..f0f76d0d10c8 100644 --- a/pkg/leader/mock_leader_elector.go +++ b/pkg/leader/mock_leader_elector.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockLeader is a mock of Leader interface. diff --git a/pkg/log/logcontext_test.go b/pkg/log/logcontext_test.go index a6e63a0fbe26..9aff646b3f64 100644 --- a/pkg/log/logcontext_test.go +++ b/pkg/log/logcontext_test.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/runtime/middleware" "github.com/go-openapi/runtime/security" "github.com/go-openapi/strfmt" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -24,6 +23,7 @@ import ( "github.com/openshift/assisted-service/restapi" "github.com/openshift/assisted-service/restapi/operations/installer" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) type AuthPayload struct { diff --git a/pkg/mirrorregistries/mock_generator.go b/pkg/mirrorregistries/mock_generator.go index a84c1d5b2e92..600dd015ba83 100644 --- a/pkg/mirrorregistries/mock_generator.go +++ b/pkg/mirrorregistries/mock_generator.go @@ -7,7 +7,7 @@ package mirrorregistries import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockServiceMirrorRegistriesConfigBuilder is a mock of ServiceMirrorRegistriesConfigBuilder interface. diff --git a/pkg/ocm/mock_accounts_mgmt.go b/pkg/ocm/mock_accounts_mgmt.go index dd5809b747ff..8c0d43f49b67 100644 --- a/pkg/ocm/mock_accounts_mgmt.go +++ b/pkg/ocm/mock_accounts_mgmt.go @@ -9,8 +9,8 @@ import ( reflect "reflect" strfmt "github.com/go-openapi/strfmt" - gomock "github.com/golang/mock/gomock" v1 "github.com/openshift-online/ocm-sdk-go/accountsmgmt/v1" + gomock "go.uber.org/mock/gomock" ) // MockOCMAccountsMgmt is a mock of OCMAccountsMgmt interface. diff --git a/pkg/ocm/mock_authorization.go b/pkg/ocm/mock_authorization.go index c2070e1bd94f..72c66912f281 100644 --- a/pkg/ocm/mock_authorization.go +++ b/pkg/ocm/mock_authorization.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockOCMAuthorization is a mock of OCMAuthorization interface. diff --git a/pkg/ocm/mock_pullsecret_auth.go b/pkg/ocm/mock_pullsecret_auth.go index c517edab064a..d75148af7c40 100644 --- a/pkg/ocm/mock_pullsecret_auth.go +++ b/pkg/ocm/mock_pullsecret_auth.go @@ -8,7 +8,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockOCMAuthentication is a mock of OCMAuthentication interface. diff --git a/pkg/s3wrapper/client_test.go b/pkg/s3wrapper/client_test.go index e907a1ee1d06..70dc01aaf01d 100644 --- a/pkg/s3wrapper/client_test.go +++ b/pkg/s3wrapper/client_test.go @@ -10,10 +10,10 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/s3" - "github.com/golang/mock/gomock" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) var _ = Describe("s3client", func() { diff --git a/pkg/s3wrapper/composite_xattr_client_test.go b/pkg/s3wrapper/composite_xattr_client_test.go index 08dd421f3195..57f0ebde176d 100644 --- a/pkg/s3wrapper/composite_xattr_client_test.go +++ b/pkg/s3wrapper/composite_xattr_client_test.go @@ -5,11 +5,11 @@ import ( "os" "path/filepath" - "github.com/golang/mock/gomock" "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" ) var _ = Describe("Composite Xattr Client", func() { diff --git a/pkg/s3wrapper/filesystem_test.go b/pkg/s3wrapper/filesystem_test.go index d5aecc4e8c13..25cd1a3c16dd 100644 --- a/pkg/s3wrapper/filesystem_test.go +++ b/pkg/s3wrapper/filesystem_test.go @@ -9,12 +9,12 @@ import ( "strings" "time" - "github.com/golang/mock/gomock" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/openshift/assisted-service/internal/metrics" "github.com/sirupsen/logrus" + "go.uber.org/mock/gomock" "golang.org/x/sys/unix" ) diff --git a/pkg/s3wrapper/mock_s3iface.go b/pkg/s3wrapper/mock_s3iface.go index c6aa1dc4ed6e..f42a09dd17c1 100644 --- a/pkg/s3wrapper/mock_s3iface.go +++ b/pkg/s3wrapper/mock_s3iface.go @@ -10,7 +10,7 @@ import ( request "github.com/aws/aws-sdk-go/aws/request" s3 "github.com/aws/aws-sdk-go/service/s3" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockS3API is a mock of S3API interface. diff --git a/pkg/s3wrapper/mock_s3manageriface.go b/pkg/s3wrapper/mock_s3manageriface.go index 0d60ed45f13a..017b37a1b3bc 100644 --- a/pkg/s3wrapper/mock_s3manageriface.go +++ b/pkg/s3wrapper/mock_s3manageriface.go @@ -9,7 +9,7 @@ import ( reflect "reflect" s3manager "github.com/aws/aws-sdk-go/service/s3/s3manager" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockUploaderAPI is a mock of UploaderAPI interface. diff --git a/pkg/s3wrapper/mock_s3wrapper.go b/pkg/s3wrapper/mock_s3wrapper.go index ab5559951891..89d6fef85be1 100644 --- a/pkg/s3wrapper/mock_s3wrapper.go +++ b/pkg/s3wrapper/mock_s3wrapper.go @@ -10,8 +10,8 @@ import ( reflect "reflect" time "time" - gomock "github.com/golang/mock/gomock" logrus "github.com/sirupsen/logrus" + gomock "go.uber.org/mock/gomock" ) // MockAPI is a mock of API interface. diff --git a/pkg/s3wrapper/mock_xattr_client.go b/pkg/s3wrapper/mock_xattr_client.go index dd585441b0c5..b1d0fe805042 100644 --- a/pkg/s3wrapper/mock_xattr_client.go +++ b/pkg/s3wrapper/mock_xattr_client.go @@ -7,7 +7,7 @@ package s3wrapper import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockXattrClient is a mock of XattrClient interface. diff --git a/pkg/staticnetworkconfig/mock_generator.go b/pkg/staticnetworkconfig/mock_generator.go index 5eec72c15d8a..1613ab6a1dd0 100644 --- a/pkg/staticnetworkconfig/mock_generator.go +++ b/pkg/staticnetworkconfig/mock_generator.go @@ -8,8 +8,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" models "github.com/openshift/assisted-service/models" + gomock "go.uber.org/mock/gomock" ) // MockStaticNetworkConfig is a mock of StaticNetworkConfig interface. diff --git a/vendor/github.com/golang/mock/mockgen/model/model.go b/vendor/github.com/golang/mock/mockgen/model/model.go deleted file mode 100644 index 2c6a62ceb268..000000000000 --- a/vendor/github.com/golang/mock/mockgen/model/model.go +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright 2012 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package model contains the data model necessary for generating mock implementations. -package model - -import ( - "encoding/gob" - "fmt" - "io" - "reflect" - "strings" -) - -// pkgPath is the importable path for package model -const pkgPath = "github.com/golang/mock/mockgen/model" - -// Package is a Go package. It may be a subset. -type Package struct { - Name string - PkgPath string - Interfaces []*Interface - DotImports []string -} - -// Print writes the package name and its exported interfaces. -func (pkg *Package) Print(w io.Writer) { - _, _ = fmt.Fprintf(w, "package %s\n", pkg.Name) - for _, intf := range pkg.Interfaces { - intf.Print(w) - } -} - -// Imports returns the imports needed by the Package as a set of import paths. -func (pkg *Package) Imports() map[string]bool { - im := make(map[string]bool) - for _, intf := range pkg.Interfaces { - intf.addImports(im) - } - return im -} - -// Interface is a Go interface. -type Interface struct { - Name string - Methods []*Method -} - -// Print writes the interface name and its methods. -func (intf *Interface) Print(w io.Writer) { - _, _ = fmt.Fprintf(w, "interface %s\n", intf.Name) - for _, m := range intf.Methods { - m.Print(w) - } -} - -func (intf *Interface) addImports(im map[string]bool) { - for _, m := range intf.Methods { - m.addImports(im) - } -} - -// AddMethod adds a new method, de-duplicating by method name. -func (intf *Interface) AddMethod(m *Method) { - for _, me := range intf.Methods { - if me.Name == m.Name { - return - } - } - intf.Methods = append(intf.Methods, m) -} - -// Method is a single method of an interface. -type Method struct { - Name string - In, Out []*Parameter - Variadic *Parameter // may be nil -} - -// Print writes the method name and its signature. -func (m *Method) Print(w io.Writer) { - _, _ = fmt.Fprintf(w, " - method %s\n", m.Name) - if len(m.In) > 0 { - _, _ = fmt.Fprintf(w, " in:\n") - for _, p := range m.In { - p.Print(w) - } - } - if m.Variadic != nil { - _, _ = fmt.Fprintf(w, " ...:\n") - m.Variadic.Print(w) - } - if len(m.Out) > 0 { - _, _ = fmt.Fprintf(w, " out:\n") - for _, p := range m.Out { - p.Print(w) - } - } -} - -func (m *Method) addImports(im map[string]bool) { - for _, p := range m.In { - p.Type.addImports(im) - } - if m.Variadic != nil { - m.Variadic.Type.addImports(im) - } - for _, p := range m.Out { - p.Type.addImports(im) - } -} - -// Parameter is an argument or return parameter of a method. -type Parameter struct { - Name string // may be empty - Type Type -} - -// Print writes a method parameter. -func (p *Parameter) Print(w io.Writer) { - n := p.Name - if n == "" { - n = `""` - } - _, _ = fmt.Fprintf(w, " - %v: %v\n", n, p.Type.String(nil, "")) -} - -// Type is a Go type. -type Type interface { - String(pm map[string]string, pkgOverride string) string - addImports(im map[string]bool) -} - -func init() { - gob.Register(&ArrayType{}) - gob.Register(&ChanType{}) - gob.Register(&FuncType{}) - gob.Register(&MapType{}) - gob.Register(&NamedType{}) - gob.Register(&PointerType{}) - - // Call gob.RegisterName to make sure it has the consistent name registered - // for both gob decoder and encoder. - // - // For a non-pointer type, gob.Register will try to get package full path by - // calling rt.PkgPath() for a name to register. If your project has vendor - // directory, it is possible that PkgPath will get a path like this: - // ../../../vendor/github.com/golang/mock/mockgen/model - gob.RegisterName(pkgPath+".PredeclaredType", PredeclaredType("")) -} - -// ArrayType is an array or slice type. -type ArrayType struct { - Len int // -1 for slices, >= 0 for arrays - Type Type -} - -func (at *ArrayType) String(pm map[string]string, pkgOverride string) string { - s := "[]" - if at.Len > -1 { - s = fmt.Sprintf("[%d]", at.Len) - } - return s + at.Type.String(pm, pkgOverride) -} - -func (at *ArrayType) addImports(im map[string]bool) { at.Type.addImports(im) } - -// ChanType is a channel type. -type ChanType struct { - Dir ChanDir // 0, 1 or 2 - Type Type -} - -func (ct *ChanType) String(pm map[string]string, pkgOverride string) string { - s := ct.Type.String(pm, pkgOverride) - if ct.Dir == RecvDir { - return "<-chan " + s - } - if ct.Dir == SendDir { - return "chan<- " + s - } - return "chan " + s -} - -func (ct *ChanType) addImports(im map[string]bool) { ct.Type.addImports(im) } - -// ChanDir is a channel direction. -type ChanDir int - -// Constants for channel directions. -const ( - RecvDir ChanDir = 1 - SendDir ChanDir = 2 -) - -// FuncType is a function type. -type FuncType struct { - In, Out []*Parameter - Variadic *Parameter // may be nil -} - -func (ft *FuncType) String(pm map[string]string, pkgOverride string) string { - args := make([]string, len(ft.In)) - for i, p := range ft.In { - args[i] = p.Type.String(pm, pkgOverride) - } - if ft.Variadic != nil { - args = append(args, "..."+ft.Variadic.Type.String(pm, pkgOverride)) - } - rets := make([]string, len(ft.Out)) - for i, p := range ft.Out { - rets[i] = p.Type.String(pm, pkgOverride) - } - retString := strings.Join(rets, ", ") - if nOut := len(ft.Out); nOut == 1 { - retString = " " + retString - } else if nOut > 1 { - retString = " (" + retString + ")" - } - return "func(" + strings.Join(args, ", ") + ")" + retString -} - -func (ft *FuncType) addImports(im map[string]bool) { - for _, p := range ft.In { - p.Type.addImports(im) - } - if ft.Variadic != nil { - ft.Variadic.Type.addImports(im) - } - for _, p := range ft.Out { - p.Type.addImports(im) - } -} - -// MapType is a map type. -type MapType struct { - Key, Value Type -} - -func (mt *MapType) String(pm map[string]string, pkgOverride string) string { - return "map[" + mt.Key.String(pm, pkgOverride) + "]" + mt.Value.String(pm, pkgOverride) -} - -func (mt *MapType) addImports(im map[string]bool) { - mt.Key.addImports(im) - mt.Value.addImports(im) -} - -// NamedType is an exported type in a package. -type NamedType struct { - Package string // may be empty - Type string -} - -func (nt *NamedType) String(pm map[string]string, pkgOverride string) string { - if pkgOverride == nt.Package { - return nt.Type - } - prefix := pm[nt.Package] - if prefix != "" { - return prefix + "." + nt.Type - } - - return nt.Type -} - -func (nt *NamedType) addImports(im map[string]bool) { - if nt.Package != "" { - im[nt.Package] = true - } -} - -// PointerType is a pointer to another type. -type PointerType struct { - Type Type -} - -func (pt *PointerType) String(pm map[string]string, pkgOverride string) string { - return "*" + pt.Type.String(pm, pkgOverride) -} -func (pt *PointerType) addImports(im map[string]bool) { pt.Type.addImports(im) } - -// PredeclaredType is a predeclared type such as "int". -type PredeclaredType string - -func (pt PredeclaredType) String(map[string]string, string) string { return string(pt) } -func (pt PredeclaredType) addImports(map[string]bool) {} - -// The following code is intended to be called by the program generated by ../reflect.go. - -// InterfaceFromInterfaceType returns a pointer to an interface for the -// given reflection interface type. -func InterfaceFromInterfaceType(it reflect.Type) (*Interface, error) { - if it.Kind() != reflect.Interface { - return nil, fmt.Errorf("%v is not an interface", it) - } - intf := &Interface{} - - for i := 0; i < it.NumMethod(); i++ { - mt := it.Method(i) - // TODO: need to skip unexported methods? or just raise an error? - m := &Method{ - Name: mt.Name, - } - - var err error - m.In, m.Variadic, m.Out, err = funcArgsFromType(mt.Type) - if err != nil { - return nil, err - } - - intf.AddMethod(m) - } - - return intf, nil -} - -// t's Kind must be a reflect.Func. -func funcArgsFromType(t reflect.Type) (in []*Parameter, variadic *Parameter, out []*Parameter, err error) { - nin := t.NumIn() - if t.IsVariadic() { - nin-- - } - var p *Parameter - for i := 0; i < nin; i++ { - p, err = parameterFromType(t.In(i)) - if err != nil { - return - } - in = append(in, p) - } - if t.IsVariadic() { - p, err = parameterFromType(t.In(nin).Elem()) - if err != nil { - return - } - variadic = p - } - for i := 0; i < t.NumOut(); i++ { - p, err = parameterFromType(t.Out(i)) - if err != nil { - return - } - out = append(out, p) - } - return -} - -func parameterFromType(t reflect.Type) (*Parameter, error) { - tt, err := typeFromType(t) - if err != nil { - return nil, err - } - return &Parameter{Type: tt}, nil -} - -var errorType = reflect.TypeOf((*error)(nil)).Elem() - -var byteType = reflect.TypeOf(byte(0)) - -func typeFromType(t reflect.Type) (Type, error) { - // Hack workaround for https://golang.org/issue/3853. - // This explicit check should not be necessary. - if t == byteType { - return PredeclaredType("byte"), nil - } - - if imp := t.PkgPath(); imp != "" { - return &NamedType{ - Package: impPath(imp), - Type: t.Name(), - }, nil - } - - // only unnamed or predeclared types after here - - // Lots of types have element types. Let's do the parsing and error checking for all of them. - var elemType Type - switch t.Kind() { - case reflect.Array, reflect.Chan, reflect.Map, reflect.Ptr, reflect.Slice: - var err error - elemType, err = typeFromType(t.Elem()) - if err != nil { - return nil, err - } - } - - switch t.Kind() { - case reflect.Array: - return &ArrayType{ - Len: t.Len(), - Type: elemType, - }, nil - case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, - reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, reflect.String: - return PredeclaredType(t.Kind().String()), nil - case reflect.Chan: - var dir ChanDir - switch t.ChanDir() { - case reflect.RecvDir: - dir = RecvDir - case reflect.SendDir: - dir = SendDir - } - return &ChanType{ - Dir: dir, - Type: elemType, - }, nil - case reflect.Func: - in, variadic, out, err := funcArgsFromType(t) - if err != nil { - return nil, err - } - return &FuncType{ - In: in, - Out: out, - Variadic: variadic, - }, nil - case reflect.Interface: - // Two special interfaces. - if t.NumMethod() == 0 { - return PredeclaredType("interface{}"), nil - } - if t == errorType { - return PredeclaredType("error"), nil - } - case reflect.Map: - kt, err := typeFromType(t.Key()) - if err != nil { - return nil, err - } - return &MapType{ - Key: kt, - Value: elemType, - }, nil - case reflect.Ptr: - return &PointerType{ - Type: elemType, - }, nil - case reflect.Slice: - return &ArrayType{ - Len: -1, - Type: elemType, - }, nil - case reflect.Struct: - if t.NumField() == 0 { - return PredeclaredType("struct{}"), nil - } - } - - // TODO: Struct, UnsafePointer - return nil, fmt.Errorf("can't yet turn %v (%v) into a model.Type", t, t.Kind()) -} - -// impPath sanitizes the package path returned by `PkgPath` method of a reflect Type so that -// it is importable. PkgPath might return a path that includes "vendor". These paths do not -// compile, so we need to remove everything up to and including "/vendor/". -// See https://github.com/golang/go/issues/12019. -func impPath(imp string) string { - if strings.HasPrefix(imp, "vendor/") { - imp = "/" + imp - } - if i := strings.LastIndex(imp, "/vendor/"); i != -1 { - imp = imp[i+len("/vendor/"):] - } - return imp -} - -// ErrorInterface represent built-in error interface. -var ErrorInterface = Interface{ - Name: "error", - Methods: []*Method{ - { - Name: "Error", - Out: []*Parameter{ - { - Name: "", - Type: PredeclaredType("string"), - }, - }, - }, - }, -} diff --git a/vendor/github.com/google/btree/.travis.yml b/vendor/github.com/google/btree/.travis.yml new file mode 100644 index 000000000000..4f2ee4d97338 --- /dev/null +++ b/vendor/github.com/google/btree/.travis.yml @@ -0,0 +1 @@ +language: go diff --git a/vendor/github.com/google/btree/README.md b/vendor/github.com/google/btree/README.md index eab5dbf7ba73..6062a4dacd49 100644 --- a/vendor/github.com/google/btree/README.md +++ b/vendor/github.com/google/btree/README.md @@ -1,5 +1,7 @@ # BTree implementation for Go +![Travis CI Build Status](https://api.travis-ci.org/google/btree.svg?branch=master) + This package provides an in-memory B-Tree implementation for Go, useful as an ordered, mutable data structure. diff --git a/vendor/github.com/google/btree/btree.go b/vendor/github.com/google/btree/btree.go index 6f5184fef7d8..b83acdbc6d3a 100644 --- a/vendor/github.com/google/btree/btree.go +++ b/vendor/github.com/google/btree/btree.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !go1.18 -// +build !go1.18 - // Package btree implements in-memory B-Trees of arbitrary degree. // // btree implements an in-memory B-Tree for use as an ordered data structure. @@ -479,7 +476,7 @@ func (n *node) growChildAndRemove(i int, item Item, minItems int, typ toRemove) child := n.mutableChild(i) // merge with right child mergeItem := n.items.removeAt(i) - mergeChild := n.children.removeAt(i + 1).mutableFor(n.cow) + mergeChild := n.children.removeAt(i + 1) child.items = append(child.items, mergeItem) child.items = append(child.items, mergeChild.items...) child.children = append(child.children, mergeChild.children...) diff --git a/vendor/github.com/google/btree/btree_generic.go b/vendor/github.com/google/btree/btree_generic.go deleted file mode 100644 index e44a0f48804a..000000000000 --- a/vendor/github.com/google/btree/btree_generic.go +++ /dev/null @@ -1,1083 +0,0 @@ -// Copyright 2014-2022 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build go1.18 -// +build go1.18 - -// In Go 1.18 and beyond, a BTreeG generic is created, and BTree is a specific -// instantiation of that generic for the Item interface, with a backwards- -// compatible API. Before go1.18, generics are not supported, -// and BTree is just an implementation based around the Item interface. - -// Package btree implements in-memory B-Trees of arbitrary degree. -// -// btree implements an in-memory B-Tree for use as an ordered data structure. -// It is not meant for persistent storage solutions. -// -// It has a flatter structure than an equivalent red-black or other binary tree, -// which in some cases yields better memory usage and/or performance. -// See some discussion on the matter here: -// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html -// Note, though, that this project is in no way related to the C++ B-Tree -// implementation written about there. -// -// Within this tree, each node contains a slice of items and a (possibly nil) -// slice of children. For basic numeric values or raw structs, this can cause -// efficiency differences when compared to equivalent C++ template code that -// stores values in arrays within the node: -// * Due to the overhead of storing values as interfaces (each -// value needs to be stored as the value itself, then 2 words for the -// interface pointing to that value and its type), resulting in higher -// memory use. -// * Since interfaces can point to values anywhere in memory, values are -// most likely not stored in contiguous blocks, resulting in a higher -// number of cache misses. -// These issues don't tend to matter, though, when working with strings or other -// heap-allocated structures, since C++-equivalent structures also must store -// pointers and also distribute their values across the heap. -// -// This implementation is designed to be a drop-in replacement to gollrb.LLRB -// trees, (http://github.com/petar/gollrb), an excellent and probably the most -// widely used ordered tree implementation in the Go ecosystem currently. -// Its functions, therefore, exactly mirror those of -// llrb.LLRB where possible. Unlike gollrb, though, we currently don't -// support storing multiple equivalent values. -// -// There are two implementations; those suffixed with 'G' are generics, usable -// for any type, and require a passed-in "less" function to define their ordering. -// Those without this prefix are specific to the 'Item' interface, and use -// its 'Less' function for ordering. -package btree - -import ( - "fmt" - "io" - "sort" - "strings" - "sync" -) - -// Item represents a single object in the tree. -type Item interface { - // Less tests whether the current item is less than the given argument. - // - // This must provide a strict weak ordering. - // If !a.Less(b) && !b.Less(a), we treat this to mean a == b (i.e. we can only - // hold one of either a or b in the tree). - Less(than Item) bool -} - -const ( - DefaultFreeListSize = 32 -) - -// FreeListG represents a free list of btree nodes. By default each -// BTree has its own FreeList, but multiple BTrees can share the same -// FreeList, in particular when they're created with Clone. -// Two Btrees using the same freelist are safe for concurrent write access. -type FreeListG[T any] struct { - mu sync.Mutex - freelist []*node[T] -} - -// NewFreeListG creates a new free list. -// size is the maximum size of the returned free list. -func NewFreeListG[T any](size int) *FreeListG[T] { - return &FreeListG[T]{freelist: make([]*node[T], 0, size)} -} - -func (f *FreeListG[T]) newNode() (n *node[T]) { - f.mu.Lock() - index := len(f.freelist) - 1 - if index < 0 { - f.mu.Unlock() - return new(node[T]) - } - n = f.freelist[index] - f.freelist[index] = nil - f.freelist = f.freelist[:index] - f.mu.Unlock() - return -} - -func (f *FreeListG[T]) freeNode(n *node[T]) (out bool) { - f.mu.Lock() - if len(f.freelist) < cap(f.freelist) { - f.freelist = append(f.freelist, n) - out = true - } - f.mu.Unlock() - return -} - -// ItemIteratorG allows callers of {A/De}scend* to iterate in-order over portions of -// the tree. When this function returns false, iteration will stop and the -// associated Ascend* function will immediately return. -type ItemIteratorG[T any] func(item T) bool - -// Ordered represents the set of types for which the '<' operator work. -type Ordered interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string -} - -// Less[T] returns a default LessFunc that uses the '<' operator for types that support it. -func Less[T Ordered]() LessFunc[T] { - return func(a, b T) bool { return a < b } -} - -// NewOrderedG creates a new B-Tree for ordered types. -func NewOrderedG[T Ordered](degree int) *BTreeG[T] { - return NewG[T](degree, Less[T]()) -} - -// NewG creates a new B-Tree with the given degree. -// -// NewG(2), for example, will create a 2-3-4 tree (each node contains 1-3 items -// and 2-4 children). -// -// The passed-in LessFunc determines how objects of type T are ordered. -func NewG[T any](degree int, less LessFunc[T]) *BTreeG[T] { - return NewWithFreeListG(degree, less, NewFreeListG[T](DefaultFreeListSize)) -} - -// NewWithFreeListG creates a new B-Tree that uses the given node free list. -func NewWithFreeListG[T any](degree int, less LessFunc[T], f *FreeListG[T]) *BTreeG[T] { - if degree <= 1 { - panic("bad degree") - } - return &BTreeG[T]{ - degree: degree, - cow: ©OnWriteContext[T]{freelist: f, less: less}, - } -} - -// items stores items in a node. -type items[T any] []T - -// insertAt inserts a value into the given index, pushing all subsequent values -// forward. -func (s *items[T]) insertAt(index int, item T) { - var zero T - *s = append(*s, zero) - if index < len(*s) { - copy((*s)[index+1:], (*s)[index:]) - } - (*s)[index] = item -} - -// removeAt removes a value at a given index, pulling all subsequent values -// back. -func (s *items[T]) removeAt(index int) T { - item := (*s)[index] - copy((*s)[index:], (*s)[index+1:]) - var zero T - (*s)[len(*s)-1] = zero - *s = (*s)[:len(*s)-1] - return item -} - -// pop removes and returns the last element in the list. -func (s *items[T]) pop() (out T) { - index := len(*s) - 1 - out = (*s)[index] - var zero T - (*s)[index] = zero - *s = (*s)[:index] - return -} - -// truncate truncates this instance at index so that it contains only the -// first index items. index must be less than or equal to length. -func (s *items[T]) truncate(index int) { - var toClear items[T] - *s, toClear = (*s)[:index], (*s)[index:] - var zero T - for i := 0; i < len(toClear); i++ { - toClear[i] = zero - } -} - -// find returns the index where the given item should be inserted into this -// list. 'found' is true if the item already exists in the list at the given -// index. -func (s items[T]) find(item T, less func(T, T) bool) (index int, found bool) { - i := sort.Search(len(s), func(i int) bool { - return less(item, s[i]) - }) - if i > 0 && !less(s[i-1], item) { - return i - 1, true - } - return i, false -} - -// node is an internal node in a tree. -// -// It must at all times maintain the invariant that either -// * len(children) == 0, len(items) unconstrained -// * len(children) == len(items) + 1 -type node[T any] struct { - items items[T] - children items[*node[T]] - cow *copyOnWriteContext[T] -} - -func (n *node[T]) mutableFor(cow *copyOnWriteContext[T]) *node[T] { - if n.cow == cow { - return n - } - out := cow.newNode() - if cap(out.items) >= len(n.items) { - out.items = out.items[:len(n.items)] - } else { - out.items = make(items[T], len(n.items), cap(n.items)) - } - copy(out.items, n.items) - // Copy children - if cap(out.children) >= len(n.children) { - out.children = out.children[:len(n.children)] - } else { - out.children = make(items[*node[T]], len(n.children), cap(n.children)) - } - copy(out.children, n.children) - return out -} - -func (n *node[T]) mutableChild(i int) *node[T] { - c := n.children[i].mutableFor(n.cow) - n.children[i] = c - return c -} - -// split splits the given node at the given index. The current node shrinks, -// and this function returns the item that existed at that index and a new node -// containing all items/children after it. -func (n *node[T]) split(i int) (T, *node[T]) { - item := n.items[i] - next := n.cow.newNode() - next.items = append(next.items, n.items[i+1:]...) - n.items.truncate(i) - if len(n.children) > 0 { - next.children = append(next.children, n.children[i+1:]...) - n.children.truncate(i + 1) - } - return item, next -} - -// maybeSplitChild checks if a child should be split, and if so splits it. -// Returns whether or not a split occurred. -func (n *node[T]) maybeSplitChild(i, maxItems int) bool { - if len(n.children[i].items) < maxItems { - return false - } - first := n.mutableChild(i) - item, second := first.split(maxItems / 2) - n.items.insertAt(i, item) - n.children.insertAt(i+1, second) - return true -} - -// insert inserts an item into the subtree rooted at this node, making sure -// no nodes in the subtree exceed maxItems items. Should an equivalent item be -// be found/replaced by insert, it will be returned. -func (n *node[T]) insert(item T, maxItems int) (_ T, _ bool) { - i, found := n.items.find(item, n.cow.less) - if found { - out := n.items[i] - n.items[i] = item - return out, true - } - if len(n.children) == 0 { - n.items.insertAt(i, item) - return - } - if n.maybeSplitChild(i, maxItems) { - inTree := n.items[i] - switch { - case n.cow.less(item, inTree): - // no change, we want first split node - case n.cow.less(inTree, item): - i++ // we want second split node - default: - out := n.items[i] - n.items[i] = item - return out, true - } - } - return n.mutableChild(i).insert(item, maxItems) -} - -// get finds the given key in the subtree and returns it. -func (n *node[T]) get(key T) (_ T, _ bool) { - i, found := n.items.find(key, n.cow.less) - if found { - return n.items[i], true - } else if len(n.children) > 0 { - return n.children[i].get(key) - } - return -} - -// min returns the first item in the subtree. -func min[T any](n *node[T]) (_ T, found bool) { - if n == nil { - return - } - for len(n.children) > 0 { - n = n.children[0] - } - if len(n.items) == 0 { - return - } - return n.items[0], true -} - -// max returns the last item in the subtree. -func max[T any](n *node[T]) (_ T, found bool) { - if n == nil { - return - } - for len(n.children) > 0 { - n = n.children[len(n.children)-1] - } - if len(n.items) == 0 { - return - } - return n.items[len(n.items)-1], true -} - -// toRemove details what item to remove in a node.remove call. -type toRemove int - -const ( - removeItem toRemove = iota // removes the given item - removeMin // removes smallest item in the subtree - removeMax // removes largest item in the subtree -) - -// remove removes an item from the subtree rooted at this node. -func (n *node[T]) remove(item T, minItems int, typ toRemove) (_ T, _ bool) { - var i int - var found bool - switch typ { - case removeMax: - if len(n.children) == 0 { - return n.items.pop(), true - } - i = len(n.items) - case removeMin: - if len(n.children) == 0 { - return n.items.removeAt(0), true - } - i = 0 - case removeItem: - i, found = n.items.find(item, n.cow.less) - if len(n.children) == 0 { - if found { - return n.items.removeAt(i), true - } - return - } - default: - panic("invalid type") - } - // If we get to here, we have children. - if len(n.children[i].items) <= minItems { - return n.growChildAndRemove(i, item, minItems, typ) - } - child := n.mutableChild(i) - // Either we had enough items to begin with, or we've done some - // merging/stealing, because we've got enough now and we're ready to return - // stuff. - if found { - // The item exists at index 'i', and the child we've selected can give us a - // predecessor, since if we've gotten here it's got > minItems items in it. - out := n.items[i] - // We use our special-case 'remove' call with typ=maxItem to pull the - // predecessor of item i (the rightmost leaf of our immediate left child) - // and set it into where we pulled the item from. - var zero T - n.items[i], _ = child.remove(zero, minItems, removeMax) - return out, true - } - // Final recursive call. Once we're here, we know that the item isn't in this - // node and that the child is big enough to remove from. - return child.remove(item, minItems, typ) -} - -// growChildAndRemove grows child 'i' to make sure it's possible to remove an -// item from it while keeping it at minItems, then calls remove to actually -// remove it. -// -// Most documentation says we have to do two sets of special casing: -// 1) item is in this node -// 2) item is in child -// In both cases, we need to handle the two subcases: -// A) node has enough values that it can spare one -// B) node doesn't have enough values -// For the latter, we have to check: -// a) left sibling has node to spare -// b) right sibling has node to spare -// c) we must merge -// To simplify our code here, we handle cases #1 and #2 the same: -// If a node doesn't have enough items, we make sure it does (using a,b,c). -// We then simply redo our remove call, and the second time (regardless of -// whether we're in case 1 or 2), we'll have enough items and can guarantee -// that we hit case A. -func (n *node[T]) growChildAndRemove(i int, item T, minItems int, typ toRemove) (T, bool) { - if i > 0 && len(n.children[i-1].items) > minItems { - // Steal from left child - child := n.mutableChild(i) - stealFrom := n.mutableChild(i - 1) - stolenItem := stealFrom.items.pop() - child.items.insertAt(0, n.items[i-1]) - n.items[i-1] = stolenItem - if len(stealFrom.children) > 0 { - child.children.insertAt(0, stealFrom.children.pop()) - } - } else if i < len(n.items) && len(n.children[i+1].items) > minItems { - // steal from right child - child := n.mutableChild(i) - stealFrom := n.mutableChild(i + 1) - stolenItem := stealFrom.items.removeAt(0) - child.items = append(child.items, n.items[i]) - n.items[i] = stolenItem - if len(stealFrom.children) > 0 { - child.children = append(child.children, stealFrom.children.removeAt(0)) - } - } else { - if i >= len(n.items) { - i-- - } - child := n.mutableChild(i) - // merge with right child - mergeItem := n.items.removeAt(i) - mergeChild := n.children.removeAt(i + 1) - child.items = append(child.items, mergeItem) - child.items = append(child.items, mergeChild.items...) - child.children = append(child.children, mergeChild.children...) - n.cow.freeNode(mergeChild) - } - return n.remove(item, minItems, typ) -} - -type direction int - -const ( - descend = direction(-1) - ascend = direction(+1) -) - -type optionalItem[T any] struct { - item T - valid bool -} - -func optional[T any](item T) optionalItem[T] { - return optionalItem[T]{item: item, valid: true} -} -func empty[T any]() optionalItem[T] { - return optionalItem[T]{} -} - -// iterate provides a simple method for iterating over elements in the tree. -// -// When ascending, the 'start' should be less than 'stop' and when descending, -// the 'start' should be greater than 'stop'. Setting 'includeStart' to true -// will force the iterator to include the first item when it equals 'start', -// thus creating a "greaterOrEqual" or "lessThanEqual" rather than just a -// "greaterThan" or "lessThan" queries. -func (n *node[T]) iterate(dir direction, start, stop optionalItem[T], includeStart bool, hit bool, iter ItemIteratorG[T]) (bool, bool) { - var ok, found bool - var index int - switch dir { - case ascend: - if start.valid { - index, _ = n.items.find(start.item, n.cow.less) - } - for i := index; i < len(n.items); i++ { - if len(n.children) > 0 { - if hit, ok = n.children[i].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - if !includeStart && !hit && start.valid && !n.cow.less(start.item, n.items[i]) { - hit = true - continue - } - hit = true - if stop.valid && !n.cow.less(n.items[i], stop.item) { - return hit, false - } - if !iter(n.items[i]) { - return hit, false - } - } - if len(n.children) > 0 { - if hit, ok = n.children[len(n.children)-1].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - case descend: - if start.valid { - index, found = n.items.find(start.item, n.cow.less) - if !found { - index = index - 1 - } - } else { - index = len(n.items) - 1 - } - for i := index; i >= 0; i-- { - if start.valid && !n.cow.less(n.items[i], start.item) { - if !includeStart || hit || n.cow.less(start.item, n.items[i]) { - continue - } - } - if len(n.children) > 0 { - if hit, ok = n.children[i+1].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - if stop.valid && !n.cow.less(stop.item, n.items[i]) { - return hit, false // continue - } - hit = true - if !iter(n.items[i]) { - return hit, false - } - } - if len(n.children) > 0 { - if hit, ok = n.children[0].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - } - return hit, true -} - -// print is used for testing/debugging purposes. -func (n *node[T]) print(w io.Writer, level int) { - fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat(" ", level), n.items) - for _, c := range n.children { - c.print(w, level+1) - } -} - -// BTreeG is a generic implementation of a B-Tree. -// -// BTreeG stores items of type T in an ordered structure, allowing easy insertion, -// removal, and iteration. -// -// Write operations are not safe for concurrent mutation by multiple -// goroutines, but Read operations are. -type BTreeG[T any] struct { - degree int - length int - root *node[T] - cow *copyOnWriteContext[T] -} - -// LessFunc[T] determines how to order a type 'T'. It should implement a strict -// ordering, and should return true if within that ordering, 'a' < 'b'. -type LessFunc[T any] func(a, b T) bool - -// copyOnWriteContext pointers determine node ownership... a tree with a write -// context equivalent to a node's write context is allowed to modify that node. -// A tree whose write context does not match a node's is not allowed to modify -// it, and must create a new, writable copy (IE: it's a Clone). -// -// When doing any write operation, we maintain the invariant that the current -// node's context is equal to the context of the tree that requested the write. -// We do this by, before we descend into any node, creating a copy with the -// correct context if the contexts don't match. -// -// Since the node we're currently visiting on any write has the requesting -// tree's context, that node is modifiable in place. Children of that node may -// not share context, but before we descend into them, we'll make a mutable -// copy. -type copyOnWriteContext[T any] struct { - freelist *FreeListG[T] - less LessFunc[T] -} - -// Clone clones the btree, lazily. Clone should not be called concurrently, -// but the original tree (t) and the new tree (t2) can be used concurrently -// once the Clone call completes. -// -// The internal tree structure of b is marked read-only and shared between t and -// t2. Writes to both t and t2 use copy-on-write logic, creating new nodes -// whenever one of b's original nodes would have been modified. Read operations -// should have no performance degredation. Write operations for both t and t2 -// will initially experience minor slow-downs caused by additional allocs and -// copies due to the aforementioned copy-on-write logic, but should converge to -// the original performance characteristics of the original tree. -func (t *BTreeG[T]) Clone() (t2 *BTreeG[T]) { - // Create two entirely new copy-on-write contexts. - // This operation effectively creates three trees: - // the original, shared nodes (old b.cow) - // the new b.cow nodes - // the new out.cow nodes - cow1, cow2 := *t.cow, *t.cow - out := *t - t.cow = &cow1 - out.cow = &cow2 - return &out -} - -// maxItems returns the max number of items to allow per node. -func (t *BTreeG[T]) maxItems() int { - return t.degree*2 - 1 -} - -// minItems returns the min number of items to allow per node (ignored for the -// root node). -func (t *BTreeG[T]) minItems() int { - return t.degree - 1 -} - -func (c *copyOnWriteContext[T]) newNode() (n *node[T]) { - n = c.freelist.newNode() - n.cow = c - return -} - -type freeType int - -const ( - ftFreelistFull freeType = iota // node was freed (available for GC, not stored in freelist) - ftStored // node was stored in the freelist for later use - ftNotOwned // node was ignored by COW, since it's owned by another one -) - -// freeNode frees a node within a given COW context, if it's owned by that -// context. It returns what happened to the node (see freeType const -// documentation). -func (c *copyOnWriteContext[T]) freeNode(n *node[T]) freeType { - if n.cow == c { - // clear to allow GC - n.items.truncate(0) - n.children.truncate(0) - n.cow = nil - if c.freelist.freeNode(n) { - return ftStored - } else { - return ftFreelistFull - } - } else { - return ftNotOwned - } -} - -// ReplaceOrInsert adds the given item to the tree. If an item in the tree -// already equals the given one, it is removed from the tree and returned, -// and the second return value is true. Otherwise, (zeroValue, false) -// -// nil cannot be added to the tree (will panic). -func (t *BTreeG[T]) ReplaceOrInsert(item T) (_ T, _ bool) { - if t.root == nil { - t.root = t.cow.newNode() - t.root.items = append(t.root.items, item) - t.length++ - return - } else { - t.root = t.root.mutableFor(t.cow) - if len(t.root.items) >= t.maxItems() { - item2, second := t.root.split(t.maxItems() / 2) - oldroot := t.root - t.root = t.cow.newNode() - t.root.items = append(t.root.items, item2) - t.root.children = append(t.root.children, oldroot, second) - } - } - out, outb := t.root.insert(item, t.maxItems()) - if !outb { - t.length++ - } - return out, outb -} - -// Delete removes an item equal to the passed in item from the tree, returning -// it. If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) Delete(item T) (T, bool) { - return t.deleteItem(item, removeItem) -} - -// DeleteMin removes the smallest item in the tree and returns it. -// If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) DeleteMin() (T, bool) { - var zero T - return t.deleteItem(zero, removeMin) -} - -// DeleteMax removes the largest item in the tree and returns it. -// If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) DeleteMax() (T, bool) { - var zero T - return t.deleteItem(zero, removeMax) -} - -func (t *BTreeG[T]) deleteItem(item T, typ toRemove) (_ T, _ bool) { - if t.root == nil || len(t.root.items) == 0 { - return - } - t.root = t.root.mutableFor(t.cow) - out, outb := t.root.remove(item, t.minItems(), typ) - if len(t.root.items) == 0 && len(t.root.children) > 0 { - oldroot := t.root - t.root = t.root.children[0] - t.cow.freeNode(oldroot) - } - if outb { - t.length-- - } - return out, outb -} - -// AscendRange calls the iterator for every value in the tree within the range -// [greaterOrEqual, lessThan), until iterator returns false. -func (t *BTreeG[T]) AscendRange(greaterOrEqual, lessThan T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, optional[T](greaterOrEqual), optional[T](lessThan), true, false, iterator) -} - -// AscendLessThan calls the iterator for every value in the tree within the range -// [first, pivot), until iterator returns false. -func (t *BTreeG[T]) AscendLessThan(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, empty[T](), optional(pivot), false, false, iterator) -} - -// AscendGreaterOrEqual calls the iterator for every value in the tree within -// the range [pivot, last], until iterator returns false. -func (t *BTreeG[T]) AscendGreaterOrEqual(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, optional[T](pivot), empty[T](), true, false, iterator) -} - -// Ascend calls the iterator for every value in the tree within the range -// [first, last], until iterator returns false. -func (t *BTreeG[T]) Ascend(iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, empty[T](), empty[T](), false, false, iterator) -} - -// DescendRange calls the iterator for every value in the tree within the range -// [lessOrEqual, greaterThan), until iterator returns false. -func (t *BTreeG[T]) DescendRange(lessOrEqual, greaterThan T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, optional[T](lessOrEqual), optional[T](greaterThan), true, false, iterator) -} - -// DescendLessOrEqual calls the iterator for every value in the tree within the range -// [pivot, first], until iterator returns false. -func (t *BTreeG[T]) DescendLessOrEqual(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, optional[T](pivot), empty[T](), true, false, iterator) -} - -// DescendGreaterThan calls the iterator for every value in the tree within -// the range [last, pivot), until iterator returns false. -func (t *BTreeG[T]) DescendGreaterThan(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, empty[T](), optional[T](pivot), false, false, iterator) -} - -// Descend calls the iterator for every value in the tree within the range -// [last, first], until iterator returns false. -func (t *BTreeG[T]) Descend(iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, empty[T](), empty[T](), false, false, iterator) -} - -// Get looks for the key item in the tree, returning it. It returns -// (zeroValue, false) if unable to find that item. -func (t *BTreeG[T]) Get(key T) (_ T, _ bool) { - if t.root == nil { - return - } - return t.root.get(key) -} - -// Min returns the smallest item in the tree, or (zeroValue, false) if the tree is empty. -func (t *BTreeG[T]) Min() (_ T, _ bool) { - return min(t.root) -} - -// Max returns the largest item in the tree, or (zeroValue, false) if the tree is empty. -func (t *BTreeG[T]) Max() (_ T, _ bool) { - return max(t.root) -} - -// Has returns true if the given key is in the tree. -func (t *BTreeG[T]) Has(key T) bool { - _, ok := t.Get(key) - return ok -} - -// Len returns the number of items currently in the tree. -func (t *BTreeG[T]) Len() int { - return t.length -} - -// Clear removes all items from the btree. If addNodesToFreelist is true, -// t's nodes are added to its freelist as part of this call, until the freelist -// is full. Otherwise, the root node is simply dereferenced and the subtree -// left to Go's normal GC processes. -// -// This can be much faster -// than calling Delete on all elements, because that requires finding/removing -// each element in the tree and updating the tree accordingly. It also is -// somewhat faster than creating a new tree to replace the old one, because -// nodes from the old tree are reclaimed into the freelist for use by the new -// one, instead of being lost to the garbage collector. -// -// This call takes: -// O(1): when addNodesToFreelist is false, this is a single operation. -// O(1): when the freelist is already full, it breaks out immediately -// O(freelist size): when the freelist is empty and the nodes are all owned -// by this tree, nodes are added to the freelist until full. -// O(tree size): when all nodes are owned by another tree, all nodes are -// iterated over looking for nodes to add to the freelist, and due to -// ownership, none are. -func (t *BTreeG[T]) Clear(addNodesToFreelist bool) { - if t.root != nil && addNodesToFreelist { - t.root.reset(t.cow) - } - t.root, t.length = nil, 0 -} - -// reset returns a subtree to the freelist. It breaks out immediately if the -// freelist is full, since the only benefit of iterating is to fill that -// freelist up. Returns true if parent reset call should continue. -func (n *node[T]) reset(c *copyOnWriteContext[T]) bool { - for _, child := range n.children { - if !child.reset(c) { - return false - } - } - return c.freeNode(n) != ftFreelistFull -} - -// Int implements the Item interface for integers. -type Int int - -// Less returns true if int(a) < int(b). -func (a Int) Less(b Item) bool { - return a < b.(Int) -} - -// BTree is an implementation of a B-Tree. -// -// BTree stores Item instances in an ordered structure, allowing easy insertion, -// removal, and iteration. -// -// Write operations are not safe for concurrent mutation by multiple -// goroutines, but Read operations are. -type BTree BTreeG[Item] - -var itemLess LessFunc[Item] = func(a, b Item) bool { - return a.Less(b) -} - -// New creates a new B-Tree with the given degree. -// -// New(2), for example, will create a 2-3-4 tree (each node contains 1-3 items -// and 2-4 children). -func New(degree int) *BTree { - return (*BTree)(NewG[Item](degree, itemLess)) -} - -// FreeList represents a free list of btree nodes. By default each -// BTree has its own FreeList, but multiple BTrees can share the same -// FreeList. -// Two Btrees using the same freelist are safe for concurrent write access. -type FreeList FreeListG[Item] - -// NewFreeList creates a new free list. -// size is the maximum size of the returned free list. -func NewFreeList(size int) *FreeList { - return (*FreeList)(NewFreeListG[Item](size)) -} - -// NewWithFreeList creates a new B-Tree that uses the given node free list. -func NewWithFreeList(degree int, f *FreeList) *BTree { - return (*BTree)(NewWithFreeListG[Item](degree, itemLess, (*FreeListG[Item])(f))) -} - -// ItemIterator allows callers of Ascend* to iterate in-order over portions of -// the tree. When this function returns false, iteration will stop and the -// associated Ascend* function will immediately return. -type ItemIterator ItemIteratorG[Item] - -// Clone clones the btree, lazily. Clone should not be called concurrently, -// but the original tree (t) and the new tree (t2) can be used concurrently -// once the Clone call completes. -// -// The internal tree structure of b is marked read-only and shared between t and -// t2. Writes to both t and t2 use copy-on-write logic, creating new nodes -// whenever one of b's original nodes would have been modified. Read operations -// should have no performance degredation. Write operations for both t and t2 -// will initially experience minor slow-downs caused by additional allocs and -// copies due to the aforementioned copy-on-write logic, but should converge to -// the original performance characteristics of the original tree. -func (t *BTree) Clone() (t2 *BTree) { - return (*BTree)((*BTreeG[Item])(t).Clone()) -} - -// Delete removes an item equal to the passed in item from the tree, returning -// it. If no such item exists, returns nil. -func (t *BTree) Delete(item Item) Item { - i, _ := (*BTreeG[Item])(t).Delete(item) - return i -} - -// DeleteMax removes the largest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMax() Item { - i, _ := (*BTreeG[Item])(t).DeleteMax() - return i -} - -// DeleteMin removes the smallest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMin() Item { - i, _ := (*BTreeG[Item])(t).DeleteMin() - return i -} - -// Get looks for the key item in the tree, returning it. It returns nil if -// unable to find that item. -func (t *BTree) Get(key Item) Item { - i, _ := (*BTreeG[Item])(t).Get(key) - return i -} - -// Max returns the largest item in the tree, or nil if the tree is empty. -func (t *BTree) Max() Item { - i, _ := (*BTreeG[Item])(t).Max() - return i -} - -// Min returns the smallest item in the tree, or nil if the tree is empty. -func (t *BTree) Min() Item { - i, _ := (*BTreeG[Item])(t).Min() - return i -} - -// Has returns true if the given key is in the tree. -func (t *BTree) Has(key Item) bool { - return (*BTreeG[Item])(t).Has(key) -} - -// ReplaceOrInsert adds the given item to the tree. If an item in the tree -// already equals the given one, it is removed from the tree and returned. -// Otherwise, nil is returned. -// -// nil cannot be added to the tree (will panic). -func (t *BTree) ReplaceOrInsert(item Item) Item { - i, _ := (*BTreeG[Item])(t).ReplaceOrInsert(item) - return i -} - -// AscendRange calls the iterator for every value in the tree within the range -// [greaterOrEqual, lessThan), until iterator returns false. -func (t *BTree) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendRange(greaterOrEqual, lessThan, (ItemIteratorG[Item])(iterator)) -} - -// AscendLessThan calls the iterator for every value in the tree within the range -// [first, pivot), until iterator returns false. -func (t *BTree) AscendLessThan(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendLessThan(pivot, (ItemIteratorG[Item])(iterator)) -} - -// AscendGreaterOrEqual calls the iterator for every value in the tree within -// the range [pivot, last], until iterator returns false. -func (t *BTree) AscendGreaterOrEqual(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendGreaterOrEqual(pivot, (ItemIteratorG[Item])(iterator)) -} - -// Ascend calls the iterator for every value in the tree within the range -// [first, last], until iterator returns false. -func (t *BTree) Ascend(iterator ItemIterator) { - (*BTreeG[Item])(t).Ascend((ItemIteratorG[Item])(iterator)) -} - -// DescendRange calls the iterator for every value in the tree within the range -// [lessOrEqual, greaterThan), until iterator returns false. -func (t *BTree) DescendRange(lessOrEqual, greaterThan Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendRange(lessOrEqual, greaterThan, (ItemIteratorG[Item])(iterator)) -} - -// DescendLessOrEqual calls the iterator for every value in the tree within the range -// [pivot, first], until iterator returns false. -func (t *BTree) DescendLessOrEqual(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendLessOrEqual(pivot, (ItemIteratorG[Item])(iterator)) -} - -// DescendGreaterThan calls the iterator for every value in the tree within -// the range [last, pivot), until iterator returns false. -func (t *BTree) DescendGreaterThan(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendGreaterThan(pivot, (ItemIteratorG[Item])(iterator)) -} - -// Descend calls the iterator for every value in the tree within the range -// [last, first], until iterator returns false. -func (t *BTree) Descend(iterator ItemIterator) { - (*BTreeG[Item])(t).Descend((ItemIteratorG[Item])(iterator)) -} - -// Len returns the number of items currently in the tree. -func (t *BTree) Len() int { - return (*BTreeG[Item])(t).Len() -} - -// Clear removes all items from the btree. If addNodesToFreelist is true, -// t's nodes are added to its freelist as part of this call, until the freelist -// is full. Otherwise, the root node is simply dereferenced and the subtree -// left to Go's normal GC processes. -// -// This can be much faster -// than calling Delete on all elements, because that requires finding/removing -// each element in the tree and updating the tree accordingly. It also is -// somewhat faster than creating a new tree to replace the old one, because -// nodes from the old tree are reclaimed into the freelist for use by the new -// one, instead of being lost to the garbage collector. -// -// This call takes: -// O(1): when addNodesToFreelist is false, this is a single operation. -// O(1): when the freelist is already full, it breaks out immediately -// O(freelist size): when the freelist is empty and the nodes are all owned -// by this tree, nodes are added to the freelist until full. -// O(tree size): when all nodes are owned by another tree, all nodes are -// iterated over looking for nodes to add to the freelist, and due to -// ownership, none are. -func (t *BTree) Clear(addNodesToFreelist bool) { - (*BTreeG[Item])(t).Clear(addNodesToFreelist) -} diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go index 4c20183239bb..80f023115ef1 100644 --- a/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go @@ -255,8 +255,8 @@ const ( // AgentServiceConfigStatus defines the observed state of AgentServiceConfig type AgentServiceConfigStatus struct { - Conditions []conditionsv1.Condition `json:"conditions,omitempty"` - ImmutableAnnotations map[string]string `json:"immutableAnnotations,omitempty"` + Conditions []conditionsv1.Condition `json:"conditions,omitempty"` + ImmutableAnnotations map[string]string `json:"immutableAnnotations,omitempty"` } // +kubebuilder:object:root=true diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go index c661393580ef..6ef20d0fa305 100644 --- a/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go @@ -25,11 +25,11 @@ import ( ) const ( - ImageCreatedReason = "ImageCreated" - ImageStateCreated = "Image has been created" - ImageCreationErrorReason = "ImageCreationError" - ImageStateFailedToCreate = "Failed to create image" - InfraEnvNameLabel = "infraenvs.agent-install.openshift.io" + ImageCreatedReason = "ImageCreated" + ImageStateCreated = "Image has been created" + ImageCreationErrorReason = "ImageCreationError" + ImageStateFailedToCreate = "Failed to create image" + InfraEnvNameLabel = "infraenvs.agent-install.openshift.io" MissingClusterDeploymentReason = "MissingClusterDeployment" MissingClusterDeploymentReference = "ClusterDeployment is missing" InfraEnvAvailableReason = "InfraEnvAvailable" @@ -50,7 +50,6 @@ type ClusterReference struct { const ( ImageCreatedCondition conditionsv1.ConditionType = "ImageCreated" ClusterDeploymentReference conditionsv1.ConditionType = "ClusterDeploymentReference" - ) type InfraEnvSpec struct { diff --git a/vendor/go.uber.org/mock/AUTHORS b/vendor/go.uber.org/mock/AUTHORS new file mode 100644 index 000000000000..660b8ccc8ae0 --- /dev/null +++ b/vendor/go.uber.org/mock/AUTHORS @@ -0,0 +1,12 @@ +# This is the official list of GoMock authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. + +# Names should be added to this file as +# Name or Organization +# The email address is not required for organizations. + +# Please keep the list sorted. + +Alex Reece +Google Inc. diff --git a/vendor/go.uber.org/mock/LICENSE b/vendor/go.uber.org/mock/LICENSE new file mode 100644 index 000000000000..d64569567334 --- /dev/null +++ b/vendor/go.uber.org/mock/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/go.uber.org/mock/gomock/call.go b/vendor/go.uber.org/mock/gomock/call.go new file mode 100644 index 000000000000..e1fe222afc84 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/call.go @@ -0,0 +1,506 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "fmt" + "reflect" + "strconv" + "strings" +) + +// Call represents an expected call to a mock. +type Call struct { + t TestHelper // for triggering test failures on invalid call setup + + receiver any // the receiver of the method call + method string // the name of the method + methodType reflect.Type // the type of the method + args []Matcher // the args + origin string // file and line number of call setup + + preReqs []*Call // prerequisite calls + + // Expectations + minCalls, maxCalls int + + numCalls int // actual number made + + // actions are called when this Call is called. Each action gets the args and + // can set the return values by returning a non-nil slice. Actions run in the + // order they are created. + actions []func([]any) []any +} + +// newCall creates a *Call. It requires the method type in order to support +// unexported methods. +func newCall(t TestHelper, receiver any, method string, methodType reflect.Type, args ...any) *Call { + t.Helper() + + // TODO: check arity, types. + mArgs := make([]Matcher, len(args)) + for i, arg := range args { + if m, ok := arg.(Matcher); ok { + mArgs[i] = m + } else if arg == nil { + // Handle nil specially so that passing a nil interface value + // will match the typed nils of concrete args. + mArgs[i] = Nil() + } else { + mArgs[i] = Eq(arg) + } + } + + // callerInfo's skip should be updated if the number of calls between the user's test + // and this line changes, i.e. this code is wrapped in another anonymous function. + // 0 is us, 1 is RecordCallWithMethodType(), 2 is the generated recorder, and 3 is the user's test. + origin := callerInfo(3) + actions := []func([]any) []any{func([]any) []any { + // Synthesize the zero value for each of the return args' types. + rets := make([]any, methodType.NumOut()) + for i := 0; i < methodType.NumOut(); i++ { + rets[i] = reflect.Zero(methodType.Out(i)).Interface() + } + return rets + }} + return &Call{ + t: t, receiver: receiver, method: method, methodType: methodType, + args: mArgs, origin: origin, minCalls: 1, maxCalls: 1, actions: actions, + } +} + +// AnyTimes allows the expectation to be called 0 or more times +func (c *Call) AnyTimes() *Call { + c.minCalls, c.maxCalls = 0, 1e8 // close enough to infinity + return c +} + +// MinTimes requires the call to occur at least n times. If AnyTimes or MaxTimes have not been called or if MaxTimes +// was previously called with 1, MinTimes also sets the maximum number of calls to infinity. +func (c *Call) MinTimes(n int) *Call { + c.minCalls = n + if c.maxCalls == 1 { + c.maxCalls = 1e8 + } + return c +} + +// MaxTimes limits the number of calls to n times. If AnyTimes or MinTimes have not been called or if MinTimes was +// previously called with 1, MaxTimes also sets the minimum number of calls to 0. +func (c *Call) MaxTimes(n int) *Call { + c.maxCalls = n + if c.minCalls == 1 { + c.minCalls = 0 + } + return c +} + +// DoAndReturn declares the action to run when the call is matched. +// The return values from this function are returned by the mocked function. +// It takes an any argument to support n-arity functions. +// The anonymous function must match the function signature mocked method. +func (c *Call) DoAndReturn(f any) *Call { + // TODO: Check arity and types here, rather than dying badly elsewhere. + v := reflect.ValueOf(f) + + c.addAction(func(args []any) []any { + c.t.Helper() + ft := v.Type() + if c.methodType.NumIn() != ft.NumIn() { + if ft.IsVariadic() { + c.t.Fatalf("wrong number of arguments in DoAndReturn func for %T.%v The function signature must match the mocked method, a variadic function cannot be used.", + c.receiver, c.method) + } else { + c.t.Fatalf("wrong number of arguments in DoAndReturn func for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, ft.NumIn(), c.methodType.NumIn(), c.origin) + } + return nil + } + vArgs := make([]reflect.Value, len(args)) + for i := 0; i < len(args); i++ { + if args[i] != nil { + vArgs[i] = reflect.ValueOf(args[i]) + } else { + // Use the zero value for the arg. + vArgs[i] = reflect.Zero(ft.In(i)) + } + } + vRets := v.Call(vArgs) + rets := make([]any, len(vRets)) + for i, ret := range vRets { + rets[i] = ret.Interface() + } + return rets + }) + return c +} + +// Do declares the action to run when the call is matched. The function's +// return values are ignored to retain backward compatibility. To use the +// return values call DoAndReturn. +// It takes an any argument to support n-arity functions. +// The anonymous function must match the function signature mocked method. +func (c *Call) Do(f any) *Call { + // TODO: Check arity and types here, rather than dying badly elsewhere. + v := reflect.ValueOf(f) + + c.addAction(func(args []any) []any { + c.t.Helper() + ft := v.Type() + if c.methodType.NumIn() != ft.NumIn() { + if ft.IsVariadic() { + c.t.Fatalf("wrong number of arguments in Do func for %T.%v The function signature must match the mocked method, a variadic function cannot be used.", + c.receiver, c.method) + } else { + c.t.Fatalf("wrong number of arguments in Do func for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, ft.NumIn(), c.methodType.NumIn(), c.origin) + } + return nil + } + vArgs := make([]reflect.Value, len(args)) + for i := 0; i < len(args); i++ { + if args[i] != nil { + vArgs[i] = reflect.ValueOf(args[i]) + } else { + // Use the zero value for the arg. + vArgs[i] = reflect.Zero(ft.In(i)) + } + } + v.Call(vArgs) + return nil + }) + return c +} + +// Return declares the values to be returned by the mocked function call. +func (c *Call) Return(rets ...any) *Call { + c.t.Helper() + + mt := c.methodType + if len(rets) != mt.NumOut() { + c.t.Fatalf("wrong number of arguments to Return for %T.%v: got %d, want %d [%s]", + c.receiver, c.method, len(rets), mt.NumOut(), c.origin) + } + for i, ret := range rets { + if got, want := reflect.TypeOf(ret), mt.Out(i); got == want { + // Identical types; nothing to do. + } else if got == nil { + // Nil needs special handling. + switch want.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + // ok + default: + c.t.Fatalf("argument %d to Return for %T.%v is nil, but %v is not nillable [%s]", + i, c.receiver, c.method, want, c.origin) + } + } else if got.AssignableTo(want) { + // Assignable type relation. Make the assignment now so that the generated code + // can return the values with a type assertion. + v := reflect.New(want).Elem() + v.Set(reflect.ValueOf(ret)) + rets[i] = v.Interface() + } else { + c.t.Fatalf("wrong type of argument %d to Return for %T.%v: %v is not assignable to %v [%s]", + i, c.receiver, c.method, got, want, c.origin) + } + } + + c.addAction(func([]any) []any { + return rets + }) + + return c +} + +// Times declares the exact number of times a function call is expected to be executed. +func (c *Call) Times(n int) *Call { + c.minCalls, c.maxCalls = n, n + return c +} + +// SetArg declares an action that will set the nth argument's value, +// indirected through a pointer. Or, in the case of a slice and map, SetArg +// will copy value's elements/key-value pairs into the nth argument. +func (c *Call) SetArg(n int, value any) *Call { + c.t.Helper() + + mt := c.methodType + // TODO: This will break on variadic methods. + // We will need to check those at invocation time. + if n < 0 || n >= mt.NumIn() { + c.t.Fatalf("SetArg(%d, ...) called for a method with %d args [%s]", + n, mt.NumIn(), c.origin) + } + // Permit setting argument through an interface. + // In the interface case, we don't (nay, can't) check the type here. + at := mt.In(n) + switch at.Kind() { + case reflect.Ptr: + dt := at.Elem() + if vt := reflect.TypeOf(value); !vt.AssignableTo(dt) { + c.t.Fatalf("SetArg(%d, ...) argument is a %v, not assignable to %v [%s]", + n, vt, dt, c.origin) + } + case reflect.Interface, reflect.Slice, reflect.Map: + // nothing to do + default: + c.t.Fatalf("SetArg(%d, ...) referring to argument of non-pointer non-interface non-slice non-map type %v [%s]", + n, at, c.origin) + } + + c.addAction(func(args []any) []any { + v := reflect.ValueOf(value) + switch reflect.TypeOf(args[n]).Kind() { + case reflect.Slice: + setSlice(args[n], v) + case reflect.Map: + setMap(args[n], v) + default: + reflect.ValueOf(args[n]).Elem().Set(v) + } + return nil + }) + return c +} + +// isPreReq returns true if other is a direct or indirect prerequisite to c. +func (c *Call) isPreReq(other *Call) bool { + for _, preReq := range c.preReqs { + if other == preReq || preReq.isPreReq(other) { + return true + } + } + return false +} + +// After declares that the call may only match after preReq has been exhausted. +func (c *Call) After(preReq *Call) *Call { + c.t.Helper() + + if c == preReq { + c.t.Fatalf("A call isn't allowed to be its own prerequisite") + } + if preReq.isPreReq(c) { + c.t.Fatalf("Loop in call order: %v is a prerequisite to %v (possibly indirectly).", c, preReq) + } + + c.preReqs = append(c.preReqs, preReq) + return c +} + +// Returns true if the minimum number of calls have been made. +func (c *Call) satisfied() bool { + return c.numCalls >= c.minCalls +} + +// Returns true if the maximum number of calls have been made. +func (c *Call) exhausted() bool { + return c.numCalls >= c.maxCalls +} + +func (c *Call) String() string { + args := make([]string, len(c.args)) + for i, arg := range c.args { + args[i] = arg.String() + } + arguments := strings.Join(args, ", ") + return fmt.Sprintf("%T.%v(%s) %s", c.receiver, c.method, arguments, c.origin) +} + +// Tests if the given call matches the expected call. +// If yes, returns nil. If no, returns error with message explaining why it does not match. +func (c *Call) matches(args []any) error { + if !c.methodType.IsVariadic() { + if len(args) != len(c.args) { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: %d", + c.origin, len(args), len(c.args)) + } + + for i, m := range c.args { + if !m.Matches(args[i]) { + return fmt.Errorf( + "expected call at %s doesn't match the argument at index %d.\nGot: %v\nWant: %v", + c.origin, i, formatGottenArg(m, args[i]), m, + ) + } + } + } else { + if len(c.args) < c.methodType.NumIn()-1 { + return fmt.Errorf("expected call at %s has the wrong number of matchers. Got: %d, want: %d", + c.origin, len(c.args), c.methodType.NumIn()-1) + } + if len(c.args) != c.methodType.NumIn() && len(args) != len(c.args) { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: %d", + c.origin, len(args), len(c.args)) + } + if len(args) < len(c.args)-1 { + return fmt.Errorf("expected call at %s has the wrong number of arguments. Got: %d, want: greater than or equal to %d", + c.origin, len(args), len(c.args)-1) + } + + for i, m := range c.args { + if i < c.methodType.NumIn()-1 { + // Non-variadic args + if !m.Matches(args[i]) { + return fmt.Errorf("expected call at %s doesn't match the argument at index %s.\nGot: %v\nWant: %v", + c.origin, strconv.Itoa(i), formatGottenArg(m, args[i]), m) + } + continue + } + // The last arg has a possibility of a variadic argument, so let it branch + + // sample: Foo(a int, b int, c ...int) + if i < len(c.args) && i < len(args) { + if m.Matches(args[i]) { + // Got Foo(a, b, c) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, someSliceMatcher) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, matcherC) + // Got Foo(a, b) want Foo(matcherA, matcherB) + // Got Foo(a, b, c, d) want Foo(matcherA, matcherB, matcherC, matcherD) + continue + } + } + + // The number of actual args don't match the number of matchers, + // or the last matcher is a slice and the last arg is not. + // If this function still matches it is because the last matcher + // matches all the remaining arguments or the lack of any. + // Convert the remaining arguments, if any, into a slice of the + // expected type. + vArgsType := c.methodType.In(c.methodType.NumIn() - 1) + vArgs := reflect.MakeSlice(vArgsType, 0, len(args)-i) + for _, arg := range args[i:] { + vArgs = reflect.Append(vArgs, reflect.ValueOf(arg)) + } + if m.Matches(vArgs.Interface()) { + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, someSliceMatcher) + // Got Foo(a, b) want Foo(matcherA, matcherB, gomock.Any()) + // Got Foo(a, b) want Foo(matcherA, matcherB, someEmptySliceMatcher) + break + } + // Wrong number of matchers or not match. Fail. + // Got Foo(a, b) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c, d) want Foo(matcherA, matcherB, matcherC, matcherD, matcherE) + // Got Foo(a, b, c, d, e) want Foo(matcherA, matcherB, matcherC, matcherD) + // Got Foo(a, b, c) want Foo(matcherA, matcherB) + + return fmt.Errorf("expected call at %s doesn't match the argument at index %s.\nGot: %v\nWant: %v", + c.origin, strconv.Itoa(i), formatGottenArg(m, args[i:]), c.args[i]) + } + } + + // Check that all prerequisite calls have been satisfied. + for _, preReqCall := range c.preReqs { + if !preReqCall.satisfied() { + return fmt.Errorf("expected call at %s doesn't have a prerequisite call satisfied:\n%v\nshould be called before:\n%v", + c.origin, preReqCall, c) + } + } + + // Check that the call is not exhausted. + if c.exhausted() { + return fmt.Errorf("expected call at %s has already been called the max number of times", c.origin) + } + + return nil +} + +// dropPrereqs tells the expected Call to not re-check prerequisite calls any +// longer, and to return its current set. +func (c *Call) dropPrereqs() (preReqs []*Call) { + preReqs = c.preReqs + c.preReqs = nil + return +} + +func (c *Call) call() []func([]any) []any { + c.numCalls++ + return c.actions +} + +// InOrder declares that the given calls should occur in order. +// It panics if the type of any of the arguments isn't *Call or a generated +// mock with an embedded *Call. +func InOrder(args ...any) { + calls := make([]*Call, 0, len(args)) + for i := 0; i < len(args); i++ { + if call := getCall(args[i]); call != nil { + calls = append(calls, call) + continue + } + panic(fmt.Sprintf( + "invalid argument at position %d of type %T, InOrder expects *gomock.Call or generated mock types with an embedded *gomock.Call", + i, + args[i], + )) + } + for i := 1; i < len(calls); i++ { + calls[i].After(calls[i-1]) + } +} + +// getCall checks if the parameter is a *Call or a generated struct +// that wraps a *Call and returns the *Call pointer - if neither, it returns nil. +func getCall(arg any) *Call { + if call, ok := arg.(*Call); ok { + return call + } + t := reflect.ValueOf(arg) + if t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface { + return nil + } + t = t.Elem() + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if !f.CanInterface() { + continue + } + if call, ok := f.Interface().(*Call); ok { + return call + } + } + return nil +} + +func setSlice(arg any, v reflect.Value) { + va := reflect.ValueOf(arg) + for i := 0; i < v.Len(); i++ { + va.Index(i).Set(v.Index(i)) + } +} + +func setMap(arg any, v reflect.Value) { + va := reflect.ValueOf(arg) + for _, e := range va.MapKeys() { + va.SetMapIndex(e, reflect.Value{}) + } + for _, e := range v.MapKeys() { + va.SetMapIndex(e, v.MapIndex(e)) + } +} + +func (c *Call) addAction(action func([]any) []any) { + c.actions = append(c.actions, action) +} + +func formatGottenArg(m Matcher, arg any) string { + got := fmt.Sprintf("%v (%T)", arg, arg) + if gs, ok := m.(GotFormatter); ok { + got = gs.Got(arg) + } + return got +} diff --git a/vendor/go.uber.org/mock/gomock/callset.go b/vendor/go.uber.org/mock/gomock/callset.go new file mode 100644 index 000000000000..f5cc592d6f40 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/callset.go @@ -0,0 +1,164 @@ +// Copyright 2011 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "bytes" + "errors" + "fmt" + "sync" +) + +// callSet represents a set of expected calls, indexed by receiver and method +// name. +type callSet struct { + // Calls that are still expected. + expected map[callSetKey][]*Call + expectedMu *sync.Mutex + // Calls that have been exhausted. + exhausted map[callSetKey][]*Call + // when set to true, existing call expectations are overridden when new call expectations are made + allowOverride bool +} + +// callSetKey is the key in the maps in callSet +type callSetKey struct { + receiver any + fname string +} + +func newCallSet() *callSet { + return &callSet{ + expected: make(map[callSetKey][]*Call), + expectedMu: &sync.Mutex{}, + exhausted: make(map[callSetKey][]*Call), + } +} + +func newOverridableCallSet() *callSet { + return &callSet{ + expected: make(map[callSetKey][]*Call), + expectedMu: &sync.Mutex{}, + exhausted: make(map[callSetKey][]*Call), + allowOverride: true, + } +} + +// Add adds a new expected call. +func (cs callSet) Add(call *Call) { + key := callSetKey{call.receiver, call.method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + m := cs.expected + if call.exhausted() { + m = cs.exhausted + } + if cs.allowOverride { + m[key] = make([]*Call, 0) + } + + m[key] = append(m[key], call) +} + +// Remove removes an expected call. +func (cs callSet) Remove(call *Call) { + key := callSetKey{call.receiver, call.method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + calls := cs.expected[key] + for i, c := range calls { + if c == call { + // maintain order for remaining calls + cs.expected[key] = append(calls[:i], calls[i+1:]...) + cs.exhausted[key] = append(cs.exhausted[key], call) + break + } + } +} + +// FindMatch searches for a matching call. Returns error with explanation message if no call matched. +func (cs callSet) FindMatch(receiver any, method string, args []any) (*Call, error) { + key := callSetKey{receiver, method} + + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + // Search through the expected calls. + expected := cs.expected[key] + var callsErrors bytes.Buffer + for _, call := range expected { + err := call.matches(args) + if err != nil { + _, _ = fmt.Fprintf(&callsErrors, "\n%v", err) + } else { + return call, nil + } + } + + // If we haven't found a match then search through the exhausted calls so we + // get useful error messages. + exhausted := cs.exhausted[key] + for _, call := range exhausted { + if err := call.matches(args); err != nil { + _, _ = fmt.Fprintf(&callsErrors, "\n%v", err) + continue + } + _, _ = fmt.Fprintf( + &callsErrors, "all expected calls for method %q have been exhausted", method, + ) + } + + if len(expected)+len(exhausted) == 0 { + _, _ = fmt.Fprintf(&callsErrors, "there are no expected calls of the method %q for that receiver", method) + } + + return nil, errors.New(callsErrors.String()) +} + +// Failures returns the calls that are not satisfied. +func (cs callSet) Failures() []*Call { + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + failures := make([]*Call, 0, len(cs.expected)) + for _, calls := range cs.expected { + for _, call := range calls { + if !call.satisfied() { + failures = append(failures, call) + } + } + } + return failures +} + +// Satisfied returns true in case all expected calls in this callSet are satisfied. +func (cs callSet) Satisfied() bool { + cs.expectedMu.Lock() + defer cs.expectedMu.Unlock() + + for _, calls := range cs.expected { + for _, call := range calls { + if !call.satisfied() { + return false + } + } + } + + return true +} diff --git a/vendor/go.uber.org/mock/gomock/controller.go b/vendor/go.uber.org/mock/gomock/controller.go new file mode 100644 index 000000000000..674c3298c40e --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/controller.go @@ -0,0 +1,326 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "context" + "fmt" + "reflect" + "runtime" + "sync" +) + +// A TestReporter is something that can be used to report test failures. It +// is satisfied by the standard library's *testing.T. +type TestReporter interface { + Errorf(format string, args ...any) + Fatalf(format string, args ...any) +} + +// TestHelper is a TestReporter that has the Helper method. It is satisfied +// by the standard library's *testing.T. +type TestHelper interface { + TestReporter + Helper() +} + +// cleanuper is used to check if TestHelper also has the `Cleanup` method. A +// common pattern is to pass in a `*testing.T` to +// `NewController(t TestReporter)`. In Go 1.14+, `*testing.T` has a cleanup +// method. This can be utilized to call `Finish()` so the caller of this library +// does not have to. +type cleanuper interface { + Cleanup(func()) +} + +// A Controller represents the top-level control of a mock ecosystem. It +// defines the scope and lifetime of mock objects, as well as their +// expectations. It is safe to call Controller's methods from multiple +// goroutines. Each test should create a new Controller. +// +// func TestFoo(t *testing.T) { +// ctrl := gomock.NewController(t) +// // .. +// } +// +// func TestBar(t *testing.T) { +// t.Run("Sub-Test-1", st) { +// ctrl := gomock.NewController(st) +// // .. +// }) +// t.Run("Sub-Test-2", st) { +// ctrl := gomock.NewController(st) +// // .. +// }) +// }) +type Controller struct { + // T should only be called within a generated mock. It is not intended to + // be used in user code and may be changed in future versions. T is the + // TestReporter passed in when creating the Controller via NewController. + // If the TestReporter does not implement a TestHelper it will be wrapped + // with a nopTestHelper. + T TestHelper + mu sync.Mutex + expectedCalls *callSet + finished bool +} + +// NewController returns a new Controller. It is the preferred way to create a Controller. +// +// Passing [*testing.T] registers cleanup function to automatically call [Controller.Finish] +// when the test and all its subtests complete. +func NewController(t TestReporter, opts ...ControllerOption) *Controller { + h, ok := t.(TestHelper) + if !ok { + h = &nopTestHelper{t} + } + ctrl := &Controller{ + T: h, + expectedCalls: newCallSet(), + } + for _, opt := range opts { + opt.apply(ctrl) + } + if c, ok := isCleanuper(ctrl.T); ok { + c.Cleanup(func() { + ctrl.T.Helper() + ctrl.finish(true, nil) + }) + } + + return ctrl +} + +// ControllerOption configures how a Controller should behave. +type ControllerOption interface { + apply(*Controller) +} + +type overridableExpectationsOption struct{} + +// WithOverridableExpectations allows for overridable call expectations +// i.e., subsequent call expectations override existing call expectations +func WithOverridableExpectations() overridableExpectationsOption { + return overridableExpectationsOption{} +} + +func (o overridableExpectationsOption) apply(ctrl *Controller) { + ctrl.expectedCalls = newOverridableCallSet() +} + +type cancelReporter struct { + t TestHelper + cancel func() +} + +func (r *cancelReporter) Errorf(format string, args ...any) { + r.t.Errorf(format, args...) +} + +func (r *cancelReporter) Fatalf(format string, args ...any) { + defer r.cancel() + r.t.Fatalf(format, args...) +} + +func (r *cancelReporter) Helper() { + r.t.Helper() +} + +// WithContext returns a new Controller and a Context, which is cancelled on any +// fatal failure. +func WithContext(ctx context.Context, t TestReporter) (*Controller, context.Context) { + h, ok := t.(TestHelper) + if !ok { + h = &nopTestHelper{t: t} + } + + ctx, cancel := context.WithCancel(ctx) + return NewController(&cancelReporter{t: h, cancel: cancel}), ctx +} + +type nopTestHelper struct { + t TestReporter +} + +func (h *nopTestHelper) Errorf(format string, args ...any) { + h.t.Errorf(format, args...) +} + +func (h *nopTestHelper) Fatalf(format string, args ...any) { + h.t.Fatalf(format, args...) +} + +func (h nopTestHelper) Helper() {} + +// RecordCall is called by a mock. It should not be called by user code. +func (ctrl *Controller) RecordCall(receiver any, method string, args ...any) *Call { + ctrl.T.Helper() + + recv := reflect.ValueOf(receiver) + for i := 0; i < recv.Type().NumMethod(); i++ { + if recv.Type().Method(i).Name == method { + return ctrl.RecordCallWithMethodType(receiver, method, recv.Method(i).Type(), args...) + } + } + ctrl.T.Fatalf("gomock: failed finding method %s on %T", method, receiver) + panic("unreachable") +} + +// RecordCallWithMethodType is called by a mock. It should not be called by user code. +func (ctrl *Controller) RecordCallWithMethodType(receiver any, method string, methodType reflect.Type, args ...any) *Call { + ctrl.T.Helper() + + call := newCall(ctrl.T, receiver, method, methodType, args...) + + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + ctrl.expectedCalls.Add(call) + + return call +} + +// Call is called by a mock. It should not be called by user code. +func (ctrl *Controller) Call(receiver any, method string, args ...any) []any { + ctrl.T.Helper() + + // Nest this code so we can use defer to make sure the lock is released. + actions := func() []func([]any) []any { + ctrl.T.Helper() + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + + expected, err := ctrl.expectedCalls.FindMatch(receiver, method, args) + if err != nil { + // callerInfo's skip should be updated if the number of calls between the user's test + // and this line changes, i.e. this code is wrapped in another anonymous function. + // 0 is us, 1 is controller.Call(), 2 is the generated mock, and 3 is the user's test. + origin := callerInfo(3) + stringArgs := make([]string, len(args)) + for i, arg := range args { + stringArgs[i] = getString(arg) + } + ctrl.T.Fatalf("Unexpected call to %T.%v(%v) at %s because: %s", receiver, method, stringArgs, origin, err) + } + + // Two things happen here: + // * the matching call no longer needs to check prerequisite calls, + // * and the prerequisite calls are no longer expected, so remove them. + preReqCalls := expected.dropPrereqs() + for _, preReqCall := range preReqCalls { + ctrl.expectedCalls.Remove(preReqCall) + } + + actions := expected.call() + if expected.exhausted() { + ctrl.expectedCalls.Remove(expected) + } + return actions + }() + + var rets []any + for _, action := range actions { + if r := action(args); r != nil { + rets = r + } + } + + return rets +} + +// Finish checks to see if all the methods that were expected to be called were called. +// It is not idempotent and therefore can only be invoked once. +// +// Note: If you pass a *testing.T into [NewController], you no longer +// need to call ctrl.Finish() in your test methods. +func (ctrl *Controller) Finish() { + // If we're currently panicking, probably because this is a deferred call. + // This must be recovered in the deferred function. + err := recover() + ctrl.finish(false, err) +} + +// Satisfied returns whether all expected calls bound to this Controller have been satisfied. +// Calling Finish is then guaranteed to not fail due to missing calls. +func (ctrl *Controller) Satisfied() bool { + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + return ctrl.expectedCalls.Satisfied() +} + +func (ctrl *Controller) finish(cleanup bool, panicErr any) { + ctrl.T.Helper() + + ctrl.mu.Lock() + defer ctrl.mu.Unlock() + + if ctrl.finished { + if _, ok := isCleanuper(ctrl.T); !ok { + ctrl.T.Fatalf("Controller.Finish was called more than once. It has to be called exactly once.") + } + return + } + ctrl.finished = true + + // Short-circuit, pass through the panic. + if panicErr != nil { + panic(panicErr) + } + + // Check that all remaining expected calls are satisfied. + failures := ctrl.expectedCalls.Failures() + for _, call := range failures { + ctrl.T.Errorf("missing call(s) to %v", call) + } + if len(failures) != 0 { + if !cleanup { + ctrl.T.Fatalf("aborting test due to missing call(s)") + return + } + ctrl.T.Errorf("aborting test due to missing call(s)") + } +} + +// callerInfo returns the file:line of the call site. skip is the number +// of stack frames to skip when reporting. 0 is callerInfo's call site. +func callerInfo(skip int) string { + if _, file, line, ok := runtime.Caller(skip + 1); ok { + return fmt.Sprintf("%s:%d", file, line) + } + return "unknown file" +} + +// isCleanuper checks it if t's base TestReporter has a Cleanup method. +func isCleanuper(t TestReporter) (cleanuper, bool) { + tr := unwrapTestReporter(t) + c, ok := tr.(cleanuper) + return c, ok +} + +// unwrapTestReporter unwraps TestReporter to the base implementation. +func unwrapTestReporter(t TestReporter) TestReporter { + tr := t + switch nt := t.(type) { + case *cancelReporter: + tr = nt.t + if h, check := tr.(*nopTestHelper); check { + tr = h.t + } + case *nopTestHelper: + tr = nt.t + default: + // not wrapped + } + return tr +} diff --git a/vendor/go.uber.org/mock/gomock/doc.go b/vendor/go.uber.org/mock/gomock/doc.go new file mode 100644 index 000000000000..696dda388209 --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/doc.go @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gomock is a mock framework for Go. +// +// Standard usage: +// +// (1) Define an interface that you wish to mock. +// type MyInterface interface { +// SomeMethod(x int64, y string) +// } +// (2) Use mockgen to generate a mock from the interface. +// (3) Use the mock in a test: +// func TestMyThing(t *testing.T) { +// mockCtrl := gomock.NewController(t) +// mockObj := something.NewMockMyInterface(mockCtrl) +// mockObj.EXPECT().SomeMethod(4, "blah") +// // pass mockObj to a real object and play with it. +// } +// +// By default, expected calls are not enforced to run in any particular order. +// Call order dependency can be enforced by use of InOrder and/or Call.After. +// Call.After can create more varied call order dependencies, but InOrder is +// often more convenient. +// +// The following examples create equivalent call order dependencies. +// +// Example of using Call.After to chain expected call order: +// +// firstCall := mockObj.EXPECT().SomeMethod(1, "first") +// secondCall := mockObj.EXPECT().SomeMethod(2, "second").After(firstCall) +// mockObj.EXPECT().SomeMethod(3, "third").After(secondCall) +// +// Example of using InOrder to declare expected call order: +// +// gomock.InOrder( +// mockObj.EXPECT().SomeMethod(1, "first"), +// mockObj.EXPECT().SomeMethod(2, "second"), +// mockObj.EXPECT().SomeMethod(3, "third"), +// ) +// +// The standard TestReporter most users will pass to `NewController` is a +// `*testing.T` from the context of the test. Note that this will use the +// standard `t.Error` and `t.Fatal` methods to report what happened in the test. +// In some cases this can leave your testing package in a weird state if global +// state is used since `t.Fatal` is like calling panic in the middle of a +// function. In these cases it is recommended that you pass in your own +// `TestReporter`. +package gomock diff --git a/vendor/go.uber.org/mock/gomock/matchers.go b/vendor/go.uber.org/mock/gomock/matchers.go new file mode 100644 index 000000000000..d52495f39e5e --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/matchers.go @@ -0,0 +1,447 @@ +// Copyright 2010 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package gomock + +import ( + "fmt" + "reflect" + "regexp" + "strings" +) + +// A Matcher is a representation of a class of values. +// It is used to represent the valid or expected arguments to a mocked method. +type Matcher interface { + // Matches returns whether x is a match. + Matches(x any) bool + + // String describes what the matcher matches. + String() string +} + +// WantFormatter modifies the given Matcher's String() method to the given +// Stringer. This allows for control on how the "Want" is formatted when +// printing . +func WantFormatter(s fmt.Stringer, m Matcher) Matcher { + type matcher interface { + Matches(x any) bool + } + + return struct { + matcher + fmt.Stringer + }{ + matcher: m, + Stringer: s, + } +} + +// StringerFunc type is an adapter to allow the use of ordinary functions as +// a Stringer. If f is a function with the appropriate signature, +// StringerFunc(f) is a Stringer that calls f. +type StringerFunc func() string + +// String implements fmt.Stringer. +func (f StringerFunc) String() string { + return f() +} + +// GotFormatter is used to better print failure messages. If a matcher +// implements GotFormatter, it will use the result from Got when printing +// the failure message. +type GotFormatter interface { + // Got is invoked with the received value. The result is used when + // printing the failure message. + Got(got any) string +} + +// GotFormatterFunc type is an adapter to allow the use of ordinary +// functions as a GotFormatter. If f is a function with the appropriate +// signature, GotFormatterFunc(f) is a GotFormatter that calls f. +type GotFormatterFunc func(got any) string + +// Got implements GotFormatter. +func (f GotFormatterFunc) Got(got any) string { + return f(got) +} + +// GotFormatterAdapter attaches a GotFormatter to a Matcher. +func GotFormatterAdapter(s GotFormatter, m Matcher) Matcher { + return struct { + GotFormatter + Matcher + }{ + GotFormatter: s, + Matcher: m, + } +} + +type anyMatcher struct{} + +func (anyMatcher) Matches(any) bool { + return true +} + +func (anyMatcher) String() string { + return "is anything" +} + +type condMatcher[T any] struct { + fn func(x T) bool +} + +func (c condMatcher[T]) Matches(x any) bool { + typed, ok := x.(T) + if !ok { + return false + } + return c.fn(typed) +} + +func (c condMatcher[T]) String() string { + return "adheres to a custom condition" +} + +type eqMatcher struct { + x any +} + +func (e eqMatcher) Matches(x any) bool { + // In case, some value is nil + if e.x == nil || x == nil { + return reflect.DeepEqual(e.x, x) + } + + // Check if types assignable and convert them to common type + x1Val := reflect.ValueOf(e.x) + x2Val := reflect.ValueOf(x) + + if x1Val.Type().AssignableTo(x2Val.Type()) { + x1ValConverted := x1Val.Convert(x2Val.Type()) + return reflect.DeepEqual(x1ValConverted.Interface(), x2Val.Interface()) + } + + return false +} + +func (e eqMatcher) String() string { + return fmt.Sprintf("is equal to %s (%T)", getString(e.x), e.x) +} + +type nilMatcher struct{} + +func (nilMatcher) Matches(x any) bool { + if x == nil { + return true + } + + v := reflect.ValueOf(x) + switch v.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, + reflect.Ptr, reflect.Slice: + return v.IsNil() + } + + return false +} + +func (nilMatcher) String() string { + return "is nil" +} + +type notMatcher struct { + m Matcher +} + +func (n notMatcher) Matches(x any) bool { + return !n.m.Matches(x) +} + +func (n notMatcher) String() string { + return "not(" + n.m.String() + ")" +} + +type regexMatcher struct { + regex *regexp.Regexp +} + +func (m regexMatcher) Matches(x any) bool { + switch t := x.(type) { + case string: + return m.regex.MatchString(t) + case []byte: + return m.regex.Match(t) + default: + return false + } +} + +func (m regexMatcher) String() string { + return "matches regex " + m.regex.String() +} + +type assignableToTypeOfMatcher struct { + targetType reflect.Type +} + +func (m assignableToTypeOfMatcher) Matches(x any) bool { + return reflect.TypeOf(x).AssignableTo(m.targetType) +} + +func (m assignableToTypeOfMatcher) String() string { + return "is assignable to " + m.targetType.Name() +} + +type anyOfMatcher struct { + matchers []Matcher +} + +func (am anyOfMatcher) Matches(x any) bool { + for _, m := range am.matchers { + if m.Matches(x) { + return true + } + } + return false +} + +func (am anyOfMatcher) String() string { + ss := make([]string, 0, len(am.matchers)) + for _, matcher := range am.matchers { + ss = append(ss, matcher.String()) + } + return strings.Join(ss, " | ") +} + +type allMatcher struct { + matchers []Matcher +} + +func (am allMatcher) Matches(x any) bool { + for _, m := range am.matchers { + if !m.Matches(x) { + return false + } + } + return true +} + +func (am allMatcher) String() string { + ss := make([]string, 0, len(am.matchers)) + for _, matcher := range am.matchers { + ss = append(ss, matcher.String()) + } + return strings.Join(ss, "; ") +} + +type lenMatcher struct { + i int +} + +func (m lenMatcher) Matches(x any) bool { + v := reflect.ValueOf(x) + switch v.Kind() { + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == m.i + default: + return false + } +} + +func (m lenMatcher) String() string { + return fmt.Sprintf("has length %d", m.i) +} + +type inAnyOrderMatcher struct { + x any +} + +func (m inAnyOrderMatcher) Matches(x any) bool { + given, ok := m.prepareValue(x) + if !ok { + return false + } + wanted, ok := m.prepareValue(m.x) + if !ok { + return false + } + + if given.Len() != wanted.Len() { + return false + } + + usedFromGiven := make([]bool, given.Len()) + foundFromWanted := make([]bool, wanted.Len()) + for i := 0; i < wanted.Len(); i++ { + wantedMatcher := Eq(wanted.Index(i).Interface()) + for j := 0; j < given.Len(); j++ { + if usedFromGiven[j] { + continue + } + if wantedMatcher.Matches(given.Index(j).Interface()) { + foundFromWanted[i] = true + usedFromGiven[j] = true + break + } + } + } + + missingFromWanted := 0 + for _, found := range foundFromWanted { + if !found { + missingFromWanted++ + } + } + extraInGiven := 0 + for _, used := range usedFromGiven { + if !used { + extraInGiven++ + } + } + + return extraInGiven == 0 && missingFromWanted == 0 +} + +func (m inAnyOrderMatcher) prepareValue(x any) (reflect.Value, bool) { + xValue := reflect.ValueOf(x) + switch xValue.Kind() { + case reflect.Slice, reflect.Array: + return xValue, true + default: + return reflect.Value{}, false + } +} + +func (m inAnyOrderMatcher) String() string { + return fmt.Sprintf("has the same elements as %v", m.x) +} + +// Constructors + +// All returns a composite Matcher that returns true if and only all of the +// matchers return true. +func All(ms ...Matcher) Matcher { return allMatcher{ms} } + +// Any returns a matcher that always matches. +func Any() Matcher { return anyMatcher{} } + +// Cond returns a matcher that matches when the given function returns true +// after passing it the parameter to the mock function. +// This is particularly useful in case you want to match over a field of a custom struct, or dynamic logic. +// +// Example usage: +// +// Cond(func(x int){return x == 1}).Matches(1) // returns true +// Cond(func(x int){return x == 2}).Matches(1) // returns false +func Cond[T any](fn func(x T) bool) Matcher { return condMatcher[T]{fn} } + +// AnyOf returns a composite Matcher that returns true if at least one of the +// matchers returns true. +// +// Example usage: +// +// AnyOf(1, 2, 3).Matches(2) // returns true +// AnyOf(1, 2, 3).Matches(10) // returns false +// AnyOf(Nil(), Len(2)).Matches(nil) // returns true +// AnyOf(Nil(), Len(2)).Matches("hi") // returns true +// AnyOf(Nil(), Len(2)).Matches("hello") // returns false +func AnyOf(xs ...any) Matcher { + ms := make([]Matcher, 0, len(xs)) + for _, x := range xs { + if m, ok := x.(Matcher); ok { + ms = append(ms, m) + } else { + ms = append(ms, Eq(x)) + } + } + return anyOfMatcher{ms} +} + +// Eq returns a matcher that matches on equality. +// +// Example usage: +// +// Eq(5).Matches(5) // returns true +// Eq(5).Matches(4) // returns false +func Eq(x any) Matcher { return eqMatcher{x} } + +// Len returns a matcher that matches on length. This matcher returns false if +// is compared to a type that is not an array, chan, map, slice, or string. +func Len(i int) Matcher { + return lenMatcher{i} +} + +// Nil returns a matcher that matches if the received value is nil. +// +// Example usage: +// +// var x *bytes.Buffer +// Nil().Matches(x) // returns true +// x = &bytes.Buffer{} +// Nil().Matches(x) // returns false +func Nil() Matcher { return nilMatcher{} } + +// Not reverses the results of its given child matcher. +// +// Example usage: +// +// Not(Eq(5)).Matches(4) // returns true +// Not(Eq(5)).Matches(5) // returns false +func Not(x any) Matcher { + if m, ok := x.(Matcher); ok { + return notMatcher{m} + } + return notMatcher{Eq(x)} +} + +// Regex checks whether parameter matches the associated regex. +// +// Example usage: +// +// Regex("[0-9]{2}:[0-9]{2}").Matches("23:02") // returns true +// Regex("[0-9]{2}:[0-9]{2}").Matches([]byte{'2', '3', ':', '0', '2'}) // returns true +// Regex("[0-9]{2}:[0-9]{2}").Matches("hello world") // returns false +// Regex("[0-9]{2}").Matches(21) // returns false as it's not a valid type +func Regex(regexStr string) Matcher { + return regexMatcher{regex: regexp.MustCompile(regexStr)} +} + +// AssignableToTypeOf is a Matcher that matches if the parameter to the mock +// function is assignable to the type of the parameter to this function. +// +// Example usage: +// +// var s fmt.Stringer = &bytes.Buffer{} +// AssignableToTypeOf(s).Matches(time.Second) // returns true +// AssignableToTypeOf(s).Matches(99) // returns false +// +// var ctx = reflect.TypeOf((*context.Context)(nil)).Elem() +// AssignableToTypeOf(ctx).Matches(context.Background()) // returns true +func AssignableToTypeOf(x any) Matcher { + if xt, ok := x.(reflect.Type); ok { + return assignableToTypeOfMatcher{xt} + } + return assignableToTypeOfMatcher{reflect.TypeOf(x)} +} + +// InAnyOrder is a Matcher that returns true for collections of the same elements ignoring the order. +// +// Example usage: +// +// InAnyOrder([]int{1, 2, 3}).Matches([]int{1, 3, 2}) // returns true +// InAnyOrder([]int{1, 2, 3}).Matches([]int{1, 2}) // returns false +func InAnyOrder(x any) Matcher { + return inAnyOrderMatcher{x} +} diff --git a/vendor/go.uber.org/mock/gomock/string.go b/vendor/go.uber.org/mock/gomock/string.go new file mode 100644 index 000000000000..ec4ca7e4d38e --- /dev/null +++ b/vendor/go.uber.org/mock/gomock/string.go @@ -0,0 +1,36 @@ +package gomock + +import ( + "fmt" + "reflect" +) + +// getString is a safe way to convert a value to a string for printing results +// If the value is a a mock, getString avoids calling the mocked String() method, +// which avoids potential deadlocks +func getString(x any) string { + if isGeneratedMock(x) { + return fmt.Sprintf("%T", x) + } + if s, ok := x.(fmt.Stringer); ok { + return s.String() + } + return fmt.Sprintf("%v", x) +} + +// isGeneratedMock checks if the given type has a "isgomock" field, +// indicating it is a generated mock. +func isGeneratedMock(x any) bool { + typ := reflect.TypeOf(x) + if typ == nil { + return false + } + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + if typ.Kind() != reflect.Struct { + return false + } + _, isgomock := typ.FieldByName("isgomock") + return isgomock +} diff --git a/vendor/modules.txt b/vendor/modules.txt index efd1f771335a..9392642518fa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -368,7 +368,6 @@ github.com/golang/groupcache/lru # github.com/golang/mock v1.6.0 ## explicit; go 1.11 github.com/golang/mock/gomock -github.com/golang/mock/mockgen/model # github.com/golang/protobuf v1.5.4 ## explicit; go 1.17 github.com/golang/protobuf/jsonpb @@ -377,8 +376,8 @@ github.com/golang/protobuf/ptypes github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp -# github.com/google/btree v1.1.3 -## explicit; go 1.18 +# github.com/google/btree v1.0.1 +## explicit; go 1.12 github.com/google/btree # github.com/google/cel-go v0.17.7 ## explicit; go 1.18 @@ -1131,6 +1130,9 @@ go.starlark.net/resolve go.starlark.net/starlark go.starlark.net/starlarkstruct go.starlark.net/syntax +# go.uber.org/mock v0.6.0 +## explicit; go 1.23.0 +go.uber.org/mock/gomock # go.uber.org/multierr v1.11.0 ## explicit; go 1.19 go.uber.org/multierr