From 66cf30c03c9fbc795288d59b3f123d2ec0458fb9 Mon Sep 17 00:00:00 2001 From: Moshe Immerman Date: Mon, 6 Nov 2023 09:54:50 +0200 Subject: [PATCH] chore: remove obsolete sdk --- sdk/.gitignore | 24 -- sdk/.swagger-codegen-ignore | 4 - sdk/.swagger-codegen/VERSION | 1 - sdk/README.md | 44 ---- sdk/api_topology.go | 150 ----------- sdk/client.go | 473 ----------------------------------- sdk/configuration.go | 71 ------ sdk/go.mod | 16 -- sdk/go.sum | 27 -- sdk/model_check.go | 33 --- sdk/model_check_status.go | 18 -- sdk/model_component.go | 44 ---- sdk/model_config.go | 19 -- sdk/model_helpers.go | 8 - sdk/model_latency.go | 16 -- sdk/model_link.go | 19 -- sdk/model_property.go | 30 --- sdk/model_summary.go | 16 -- sdk/model_uptime.go | 15 -- sdk/response.go | 42 ---- 20 files changed, 1070 deletions(-) delete mode 100644 sdk/.gitignore delete mode 100644 sdk/.swagger-codegen-ignore delete mode 100644 sdk/.swagger-codegen/VERSION delete mode 100644 sdk/README.md delete mode 100644 sdk/api_topology.go delete mode 100644 sdk/client.go delete mode 100644 sdk/configuration.go delete mode 100644 sdk/go.mod delete mode 100644 sdk/go.sum delete mode 100644 sdk/model_check.go delete mode 100644 sdk/model_check_status.go delete mode 100644 sdk/model_component.go delete mode 100644 sdk/model_config.go delete mode 100644 sdk/model_helpers.go delete mode 100644 sdk/model_latency.go delete mode 100644 sdk/model_link.go delete mode 100644 sdk/model_property.go delete mode 100644 sdk/model_summary.go delete mode 100644 sdk/model_uptime.go delete mode 100644 sdk/response.go diff --git a/sdk/.gitignore b/sdk/.gitignore deleted file mode 100644 index daf913b1b..000000000 --- a/sdk/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof diff --git a/sdk/.swagger-codegen-ignore b/sdk/.swagger-codegen-ignore deleted file mode 100644 index ade67399d..000000000 --- a/sdk/.swagger-codegen-ignore +++ /dev/null @@ -1,4 +0,0 @@ -.travis.yml -git_push.sh -api/ -docs/ diff --git a/sdk/.swagger-codegen/VERSION b/sdk/.swagger-codegen/VERSION deleted file mode 100644 index 053a355ae..000000000 --- a/sdk/.swagger-codegen/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.0.35 \ No newline at end of file diff --git a/sdk/README.md b/sdk/README.md deleted file mode 100644 index b9a15c99c..000000000 --- a/sdk/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Go API client for swagger - -No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - -## Overview -This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. - -- API version: 1..1 -- Package version: 1.0.0 -- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen - -## Installation -Put the package under your project folder and add the following in import: -```golang -import "./swagger" -``` - -## Documentation for API Endpoints - -All URIs are relative to */* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*TopologyApi* | [**TopologyQuery**](docs/TopologyApi.md#topologyquery) | **Get** /api/topology | Topology query - -## Documentation For Models - - - [Check](docs/Check.md) - - [CheckStatus](docs/CheckStatus.md) - - [Component](docs/Component.md) - - [Config](docs/Config.md) - - [Latency](docs/Latency.md) - - [Link](docs/Link.md) - - [Property](docs/Property.md) - - [Summary](docs/Summary.md) - - [Uptime](docs/Uptime.md) - -## Documentation For Authorization - Endpoints do not require authorization. - - -## Author - - diff --git a/sdk/api_topology.go b/sdk/api_topology.go deleted file mode 100644 index 186ec7172..000000000 --- a/sdk/api_topology.go +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -import ( - "context" - "io" - "net/http" - "net/url" - "strings" - - "github.com/antihax/optional" -) - -// Linger please -var ( - _ context.Context -) - -type TopologyApiService service - -/* -TopologyApiService Topology query -Query the topology graph - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param optional nil or *TopologyApiTopologyQueryOpts - Optional Parameters: - * @param "Id" (optional.String) - Topology ID - * @param "TopologyId" (optional.String) - Topology ID - * @param "ComponentId" (optional.String) - Component ID - * @param "Owner" (optional.String) - Owner - * @param "Status" (optional.String) - Comma seperated list of status - * @param "Types" (optional.String) - Comma seperated list of types - * @param "Flatten" (optional.String) - Flatten the topology -@return []Component -*/ - -type TopologyApiTopologyQueryOpts struct { - Id optional.String - TopologyId optional.String - ComponentId optional.String - Owner optional.String - Status optional.String - Types optional.String - Flatten optional.String -} - -func (a *TopologyApiService) TopologyQuery(ctx context.Context, localVarOptionals *TopologyApiTopologyQueryOpts) ([]Component, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue []Component - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/api/topology" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if localVarOptionals != nil && localVarOptionals.Id.IsSet() { - localVarQueryParams.Add("id", parameterToString(localVarOptionals.Id.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.TopologyId.IsSet() { - localVarQueryParams.Add("topologyId", parameterToString(localVarOptionals.TopologyId.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.ComponentId.IsSet() { - localVarQueryParams.Add("componentId", parameterToString(localVarOptionals.ComponentId.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Owner.IsSet() { - localVarQueryParams.Add("owner", parameterToString(localVarOptionals.Owner.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Status.IsSet() { - localVarQueryParams.Add("status", parameterToString(localVarOptionals.Status.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Types.IsSet() { - localVarQueryParams.Add("types", parameterToString(localVarOptionals.Types.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Flatten.IsSet() { - localVarQueryParams.Add("flatten", parameterToString(localVarOptionals.Flatten.Value(), "")) - } - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := io.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v []Component - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} diff --git a/sdk/client.go b/sdk/client.go deleted file mode 100644 index 1debf5287..000000000 --- a/sdk/client.go +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "mime/multipart" - "net/http" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - - "golang.org/x/oauth2" -) - -var ( - jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") - xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") -) - -// APIClient manages communication with the Canary Checker API API v1..1 -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services - - TopologyApi *TopologyApiService -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(cfg *Configuration) *APIClient { - if cfg.HTTPClient == nil { - cfg.HTTPClient = http.DefaultClient - } - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - - // API Services - c.TopologyApi = (*TopologyApiService)(&c.common) - - return c -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insenstive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," - } - - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } - - return fmt.Sprintf("%v", obj) -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - return c.cfg.HTTPClient.Do(request) -} - -// Change base path to allow switching to mocks -func (c *APIClient) ChangeBasePath(path string) { - c.cfg.BasePath = path -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - fileName string, - fileBytes []byte) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - if len(fileBytes) > 0 && fileName != "" { - w.Boundary() - //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile("file", filepath.Base(fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(fileBytes) - if err != nil { - return nil, err - } - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - } - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = query.Encode() - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers.Set(h, v) - } - localVarRequest.Header = headers - } - - // Override request host, if applicable - if c.cfg.Host != "" { - localVarRequest.Host = c.cfg.Host - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { - // We were able to grab an oauth2 token from the context - var latestToken *oauth2.Token - if latestToken, err = tok.Token(); err != nil { - return nil, err - } - - latestToken.SetAuthHeader(localVarRequest) - } - - // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { - localVarRequest.SetBasicAuth(auth.UserName, auth.Password) - } - - // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { - localVarRequest.Header.Add("Authorization", "Bearer "+auth) - } - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if strings.Contains(contentType, "application/xml") { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } else if strings.Contains(contentType, "application/json") { - if err = json.Unmarshal(b, v); err != nil { - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if jsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if xmlCheck.MatchString(contentType) { - xml.NewEncoder(bodyBuf).Encode(body) - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("Invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } - expires = now.Add(lifetime) - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// GenericSwaggerError Provides access to the body, error and model on returned errors. -type GenericSwaggerError struct { - body []byte - error string - model interface{} -} - -// Error returns non-empty string if there was an error. -func (e GenericSwaggerError) Error() string { - return e.error -} - -// Body returns the raw bytes of the response -func (e GenericSwaggerError) Body() []byte { - return e.body -} - -// Model returns the unpacked model of the error -func (e GenericSwaggerError) Model() interface{} { - return e.model -} diff --git a/sdk/configuration.go b/sdk/configuration.go deleted file mode 100644 index f098cb0d5..000000000 --- a/sdk/configuration.go +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -import ( - "net/http" -) - -// contextKeys are used to identify the type of value in the context. -// Since these are string, it is possible to get a short description of the -// context key for logging and debugging using key.String(). - -type contextKey string - -func (c contextKey) String() string { - return "auth " + string(c) -} - -var ( - // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextAPIKey takes an APIKey as authentication for the request - ContextAPIKey = contextKey("apikey") -) - -// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth -type BasicAuth struct { - UserName string `json:"userName,omitempty"` - Password string `json:"password,omitempty"` -} - -// APIKey provides API key based authentication to a request passed via context using ContextAPIKey -type APIKey struct { - Key string - Prefix string -} - -type Configuration struct { - BasePath string `json:"basePath,omitempty"` - Host string `json:"host,omitempty"` - Scheme string `json:"scheme,omitempty"` - DefaultHeader map[string]string `json:"defaultHeader,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - HTTPClient *http.Client -} - -func NewConfiguration() *Configuration { - cfg := &Configuration{ - BasePath: "/", - DefaultHeader: make(map[string]string), - UserAgent: "Swagger-Codegen/1.0.0/go", - } - return cfg -} - -func (c *Configuration) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value -} diff --git a/sdk/go.mod b/sdk/go.mod deleted file mode 100644 index 24652c636..000000000 --- a/sdk/go.mod +++ /dev/null @@ -1,16 +0,0 @@ -module github.com/flanksource/canary-checker/sdk - -go 1.18 - -require ( - github.com/antihax/optional v1.0.0 - github.com/google/uuid v1.3.0 - golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 -) - -require ( - github.com/golang/protobuf v1.5.2 // indirect - golang.org/x/net v0.7.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect -) diff --git a/sdk/go.sum b/sdk/go.sum deleted file mode 100644 index e350ca067..000000000 --- a/sdk/go.sum +++ /dev/null @@ -1,27 +0,0 @@ -github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 h1:lxqLZaMad/dJHMFZH0NiNpiEZI/nhgWhe4wgzpE+MuA= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/sdk/model_check.go b/sdk/model_check.go deleted file mode 100644 index cd57c6d64..000000000 --- a/sdk/model_check.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Check struct { - CanaryId string `json:"canary_id,omitempty"` - CanaryName string `json:"canary_name,omitempty"` - CheckStatuses []CheckStatus `json:"checkStatuses,omitempty"` - CreatedAt string `json:"createdAt,omitempty"` - DeletedAt string `json:"deletedAt,omitempty"` - Description string `json:"description,omitempty"` - DisplayType string `json:"displayType,omitempty"` - Icon string `json:"icon,omitempty"` - Id string `json:"id,omitempty"` - Labels *interface{} `json:"labels,omitempty"` - LastRuntime string `json:"lastRuntime,omitempty"` - Latency *Latency `json:"latency,omitempty"` - Name string `json:"name,omitempty"` - Namespace string `json:"namespace,omitempty"` - NextRuntime string `json:"nextRuntime,omitempty"` - Owner string `json:"owner,omitempty"` - Severity string `json:"severity,omitempty"` - Status string `json:"status,omitempty"` - Type_ string `json:"type,omitempty"` - UpdatedAt string `json:"updatedAt,omitempty"` - Uptime *Uptime `json:"uptime,omitempty"` -} diff --git a/sdk/model_check_status.go b/sdk/model_check_status.go deleted file mode 100644 index e472e6199..000000000 --- a/sdk/model_check_status.go +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type CheckStatus struct { - Duration int32 `json:"duration,omitempty"` - Error_ string `json:"error,omitempty"` - Invalid bool `json:"invalid,omitempty"` - Message string `json:"message,omitempty"` - Status bool `json:"status,omitempty"` - Time string `json:"time,omitempty"` -} diff --git a/sdk/model_component.go b/sdk/model_component.go deleted file mode 100644 index cb7204613..000000000 --- a/sdk/model_component.go +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Component struct { - Checks []Check `json:"checks,omitempty"` - Components *[]Component `json:"components,omitempty"` - Configs []Config `json:"configs,omitempty"` - CreatedAt string `json:"created_at,omitempty"` - // nolint - ExternalId string `json:"external_id,omitempty"` - Icon string `json:"icon,omitempty"` - // nolint - Id string `json:"id,omitempty"` - Labels *interface{} `json:"labels,omitempty"` - // The lifecycle state of the component e.g. production, staging, dev, etc. - Lifecycle string `json:"lifecycle,omitempty"` - Name string `json:"name,omitempty"` - Namespace string `json:"namespace,omitempty"` - Order int32 `json:"order,omitempty"` - Owner string `json:"owner,omitempty"` - // nolint - ParentId string `json:"parent_id,omitempty"` - Path string `json:"path,omitempty"` - Properties []Property `json:"properties,omitempty"` - Schedule string `json:"schedule,omitempty"` - Status string `json:"status,omitempty"` - StatusReason string `json:"status_reason,omitempty"` - Summary *Summary `json:"summary,omitempty"` - // nolint - TopologyID string `json:"topology_id,omitempty"` - Text string `json:"text,omitempty"` - Tooltip string `json:"tooltip,omitempty"` - TopologyType string `json:"topology_type,omitempty"` - // The type of component, e.g. service, API, website, library, database, etc. - Type_ string `json:"type,omitempty"` - UpdatedAt string `json:"updated_at,omitempty"` -} diff --git a/sdk/model_config.go b/sdk/model_config.go deleted file mode 100644 index db0ff083c..000000000 --- a/sdk/model_config.go +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Config struct { - Id string `json:"id,omitempty"` - ConfigClass string `json:"config_class,omitempty"` - ExternalId []string `json:"external_id,omitempty"` - Type string `json:"type,omitempty"` - Name string `json:"name,omitempty"` - Namespace string `json:"namespace,omitempty"` - Spec *interface{} `json:"spec,omitempty"` -} diff --git a/sdk/model_helpers.go b/sdk/model_helpers.go deleted file mode 100644 index 11b5a115d..000000000 --- a/sdk/model_helpers.go +++ /dev/null @@ -1,8 +0,0 @@ -package swagger - -import "github.com/google/uuid" - -func (c Component) GetUUID() *uuid.UUID { - id, _ := uuid.Parse(c.Id) - return &id -} diff --git a/sdk/model_latency.go b/sdk/model_latency.go deleted file mode 100644 index 951129901..000000000 --- a/sdk/model_latency.go +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Latency struct { - P95 float64 `json:"p95,omitempty"` - P97 float64 `json:"p97,omitempty"` - P99 float64 `json:"p99,omitempty"` - Rolling1h float64 `json:"rolling1h,omitempty"` -} diff --git a/sdk/model_link.go b/sdk/model_link.go deleted file mode 100644 index edd895d27..000000000 --- a/sdk/model_link.go +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Link struct { - Icon string `json:"icon,omitempty"` - Label string `json:"label,omitempty"` - Text string `json:"text,omitempty"` - Tooltip string `json:"tooltip,omitempty"` - // e.g. documentation, support, playbook - Type_ string `json:"type,omitempty"` - Url string `json:"url,omitempty"` -} diff --git a/sdk/model_property.go b/sdk/model_property.go deleted file mode 100644 index 65b3e4a16..000000000 --- a/sdk/model_property.go +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Property struct { - Color string `json:"color,omitempty"` - Headline bool `json:"headline,omitempty"` - Icon string `json:"icon,omitempty"` - Label string `json:"label,omitempty"` - LastTransition string `json:"lastTransition,omitempty"` - Links []Link `json:"links,omitempty"` - Max int32 `json:"max,omitempty"` - Min int32 `json:"min,omitempty"` - Name string `json:"name,omitempty"` - Order int32 `json:"order,omitempty"` - Status string `json:"status,omitempty"` - // Either text or value is required, but not both. - Text string `json:"text,omitempty"` - Tooltip string `json:"tooltip,omitempty"` - Type_ string `json:"type,omitempty"` - // e.g. milliseconds, bytes, millicores, epoch etc. - Unit string `json:"unit,omitempty"` - Value int32 `json:"value,omitempty"` -} diff --git a/sdk/model_summary.go b/sdk/model_summary.go deleted file mode 100644 index 41c36ecc0..000000000 --- a/sdk/model_summary.go +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Summary struct { - Healthy int32 `json:"healthy,omitempty"` - Info int32 `json:"info,omitempty"` - Unhealthy int32 `json:"unhealthy,omitempty"` - Warning int32 `json:"warning,omitempty"` -} diff --git a/sdk/model_uptime.go b/sdk/model_uptime.go deleted file mode 100644 index dfd44aed2..000000000 --- a/sdk/model_uptime.go +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -type Uptime struct { - Failed int32 `json:"failed,omitempty"` - P100 float64 `json:"p100,omitempty"` - Passed int32 `json:"passed,omitempty"` -} diff --git a/sdk/response.go b/sdk/response.go deleted file mode 100644 index be2bbd28e..000000000 --- a/sdk/response.go +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Canary Checker API - * - * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) - * - * API version: 1..1 - * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) - */ -package swagger - -import ( - "net/http" -) - -type APIResponse struct { - *http.Response `json:"-"` - Message string `json:"message,omitempty"` - // Operation is the name of the swagger operation. - Operation string `json:"operation,omitempty"` - // RequestURL is the request URL. This value is always available, even if the - // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` - // Method is the HTTP method used for the request. This value is always - // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` - // Payload holds the contents of the response body (which may be nil or empty). - // This is provided here as the raw response.Body() reader will have already - // been drained. - Payload []byte `json:"-"` -} - -func NewAPIResponse(r *http.Response) *APIResponse { - - response := &APIResponse{Response: r} - return response -} - -func NewAPIResponseWithError(errorMessage string) *APIResponse { - - response := &APIResponse{Message: errorMessage} - return response -}