forked from ory/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics_api.go
93 lines (79 loc) · 2.91 KB
/
metrics_api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* ORY Hydra - Cloud Native OAuth 2.0 and OpenID Connect Server
*
* Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. Keep in mind that this document reflects the latest branch, always. Support for versioned documentation is coming in the future.
*
* OpenAPI spec version: Latest
* Contact: hi@ory.am
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
package swagger
import (
"net/url"
"strings"
)
type MetricsApi struct {
Configuration *Configuration
}
func NewMetricsApi() *MetricsApi {
configuration := NewConfiguration()
return &MetricsApi{
Configuration: configuration,
}
}
func NewMetricsApiWithBasePath(basePath string) *MetricsApi {
configuration := NewConfiguration()
configuration.BasePath = basePath
return &MetricsApi{
Configuration: configuration,
}
}
/**
* Retrieve Prometheus metrics
* This endpoint returns metrics formatted for Prometheus.
*
* @return void
*/
func (a MetricsApi) GetPrometheusMetrics() (*APIResponse, error) {
var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
localVarPath := a.Configuration.BasePath + "/metrics/prometheus"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := make(map[string]string)
var localVarPostBody interface{}
var localVarFileName string
var localVarFileBytes []byte
// add default headers if any
for key := range a.Configuration.DefaultHeader {
localVarHeaderParams[key] = a.Configuration.DefaultHeader[key]
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "application/x-www-form-urlencoded"}
// set Content-Type header
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// set Accept header
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
var localVarURL, _ = url.Parse(localVarPath)
localVarURL.RawQuery = localVarQueryParams.Encode()
var localVarAPIResponse = &APIResponse{Operation: "GetPrometheusMetrics", Method: localVarHttpMethod, RequestURL: localVarURL.String()}
if localVarHttpResponse != nil {
localVarAPIResponse.Response = localVarHttpResponse.RawResponse
localVarAPIResponse.Payload = localVarHttpResponse.Body()
}
if err != nil {
return localVarAPIResponse, err
}
return localVarAPIResponse, err
}