mirror of
https://github.com/openziti/zrok.git
synced 2025-02-16 18:20:51 +01:00
duration parameter (#319)
This commit is contained in:
parent
58a225284d
commit
21fdaf8e3c
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
cr "github.com/go-openapi/runtime/client"
|
cr "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetAccountMetricsParams creates a new GetAccountMetricsParams object,
|
// NewGetAccountMetricsParams creates a new GetAccountMetricsParams object,
|
||||||
@ -60,6 +61,10 @@ GetAccountMetricsParams contains all the parameters to send to the API endpoint
|
|||||||
Typically these are written to a http.Request.
|
Typically these are written to a http.Request.
|
||||||
*/
|
*/
|
||||||
type GetAccountMetricsParams struct {
|
type GetAccountMetricsParams struct {
|
||||||
|
|
||||||
|
// Duration.
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
Context context.Context
|
Context context.Context
|
||||||
HTTPClient *http.Client
|
HTTPClient *http.Client
|
||||||
@ -113,6 +118,17 @@ func (o *GetAccountMetricsParams) SetHTTPClient(client *http.Client) {
|
|||||||
o.HTTPClient = client
|
o.HTTPClient = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDuration adds the duration to the get account metrics params
|
||||||
|
func (o *GetAccountMetricsParams) WithDuration(duration *float64) *GetAccountMetricsParams {
|
||||||
|
o.SetDuration(duration)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDuration adds the duration to the get account metrics params
|
||||||
|
func (o *GetAccountMetricsParams) SetDuration(duration *float64) {
|
||||||
|
o.Duration = duration
|
||||||
|
}
|
||||||
|
|
||||||
// WriteToRequest writes these params to a swagger request
|
// WriteToRequest writes these params to a swagger request
|
||||||
func (o *GetAccountMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
func (o *GetAccountMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||||
|
|
||||||
@ -121,6 +137,23 @@ func (o *GetAccountMetricsParams) WriteToRequest(r runtime.ClientRequest, reg st
|
|||||||
}
|
}
|
||||||
var res []error
|
var res []error
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
|
||||||
|
// query param duration
|
||||||
|
var qrDuration float64
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
qrDuration = *o.Duration
|
||||||
|
}
|
||||||
|
qDuration := swag.FormatFloat64(qrDuration)
|
||||||
|
if qDuration != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("duration", qDuration); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(res) > 0 {
|
if len(res) > 0 {
|
||||||
return errors.CompositeValidationError(res...)
|
return errors.CompositeValidationError(res...)
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
cr "github.com/go-openapi/runtime/client"
|
cr "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetEnvironmentMetricsParams creates a new GetEnvironmentMetricsParams object,
|
// NewGetEnvironmentMetricsParams creates a new GetEnvironmentMetricsParams object,
|
||||||
@ -61,6 +62,9 @@ GetEnvironmentMetricsParams contains all the parameters to send to the API endpo
|
|||||||
*/
|
*/
|
||||||
type GetEnvironmentMetricsParams struct {
|
type GetEnvironmentMetricsParams struct {
|
||||||
|
|
||||||
|
// Duration.
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
// EnvID.
|
// EnvID.
|
||||||
EnvID string
|
EnvID string
|
||||||
|
|
||||||
@ -117,6 +121,17 @@ func (o *GetEnvironmentMetricsParams) SetHTTPClient(client *http.Client) {
|
|||||||
o.HTTPClient = client
|
o.HTTPClient = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDuration adds the duration to the get environment metrics params
|
||||||
|
func (o *GetEnvironmentMetricsParams) WithDuration(duration *float64) *GetEnvironmentMetricsParams {
|
||||||
|
o.SetDuration(duration)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDuration adds the duration to the get environment metrics params
|
||||||
|
func (o *GetEnvironmentMetricsParams) SetDuration(duration *float64) {
|
||||||
|
o.Duration = duration
|
||||||
|
}
|
||||||
|
|
||||||
// WithEnvID adds the envID to the get environment metrics params
|
// WithEnvID adds the envID to the get environment metrics params
|
||||||
func (o *GetEnvironmentMetricsParams) WithEnvID(envID string) *GetEnvironmentMetricsParams {
|
func (o *GetEnvironmentMetricsParams) WithEnvID(envID string) *GetEnvironmentMetricsParams {
|
||||||
o.SetEnvID(envID)
|
o.SetEnvID(envID)
|
||||||
@ -136,6 +151,23 @@ func (o *GetEnvironmentMetricsParams) WriteToRequest(r runtime.ClientRequest, re
|
|||||||
}
|
}
|
||||||
var res []error
|
var res []error
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
|
||||||
|
// query param duration
|
||||||
|
var qrDuration float64
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
qrDuration = *o.Duration
|
||||||
|
}
|
||||||
|
qDuration := swag.FormatFloat64(qrDuration)
|
||||||
|
if qDuration != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("duration", qDuration); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// path param envId
|
// path param envId
|
||||||
if err := r.SetPathParam("envId", o.EnvID); err != nil {
|
if err := r.SetPathParam("envId", o.EnvID); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/go-openapi/runtime"
|
"github.com/go-openapi/runtime"
|
||||||
cr "github.com/go-openapi/runtime/client"
|
cr "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetShareMetricsParams creates a new GetShareMetricsParams object,
|
// NewGetShareMetricsParams creates a new GetShareMetricsParams object,
|
||||||
@ -61,6 +62,9 @@ GetShareMetricsParams contains all the parameters to send to the API endpoint
|
|||||||
*/
|
*/
|
||||||
type GetShareMetricsParams struct {
|
type GetShareMetricsParams struct {
|
||||||
|
|
||||||
|
// Duration.
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
// ShrToken.
|
// ShrToken.
|
||||||
ShrToken string
|
ShrToken string
|
||||||
|
|
||||||
@ -117,6 +121,17 @@ func (o *GetShareMetricsParams) SetHTTPClient(client *http.Client) {
|
|||||||
o.HTTPClient = client
|
o.HTTPClient = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDuration adds the duration to the get share metrics params
|
||||||
|
func (o *GetShareMetricsParams) WithDuration(duration *float64) *GetShareMetricsParams {
|
||||||
|
o.SetDuration(duration)
|
||||||
|
return o
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDuration adds the duration to the get share metrics params
|
||||||
|
func (o *GetShareMetricsParams) SetDuration(duration *float64) {
|
||||||
|
o.Duration = duration
|
||||||
|
}
|
||||||
|
|
||||||
// WithShrToken adds the shrToken to the get share metrics params
|
// WithShrToken adds the shrToken to the get share metrics params
|
||||||
func (o *GetShareMetricsParams) WithShrToken(shrToken string) *GetShareMetricsParams {
|
func (o *GetShareMetricsParams) WithShrToken(shrToken string) *GetShareMetricsParams {
|
||||||
o.SetShrToken(shrToken)
|
o.SetShrToken(shrToken)
|
||||||
@ -136,6 +151,23 @@ func (o *GetShareMetricsParams) WriteToRequest(r runtime.ClientRequest, reg strf
|
|||||||
}
|
}
|
||||||
var res []error
|
var res []error
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
|
||||||
|
// query param duration
|
||||||
|
var qrDuration float64
|
||||||
|
|
||||||
|
if o.Duration != nil {
|
||||||
|
qrDuration = *o.Duration
|
||||||
|
}
|
||||||
|
qDuration := swag.FormatFloat64(qrDuration)
|
||||||
|
if qDuration != "" {
|
||||||
|
|
||||||
|
if err := r.SetQueryParam("duration", qDuration); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// path param shrToken
|
// path param shrToken
|
||||||
if err := r.SetPathParam("shrToken", o.ShrToken); err != nil {
|
if err := r.SetPathParam("shrToken", o.ShrToken); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -531,6 +531,13 @@ func init() {
|
|||||||
"metrics"
|
"metrics"
|
||||||
],
|
],
|
||||||
"operationId": "getAccountMetrics",
|
"operationId": "getAccountMetrics",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "account metrics",
|
"description": "account metrics",
|
||||||
@ -558,6 +565,11 @@ func init() {
|
|||||||
"name": "envId",
|
"name": "envId",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -590,6 +602,11 @@ func init() {
|
|||||||
"name": "shrToken",
|
"name": "shrToken",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -1924,6 +1941,13 @@ func init() {
|
|||||||
"metrics"
|
"metrics"
|
||||||
],
|
],
|
||||||
"operationId": "getAccountMetrics",
|
"operationId": "getAccountMetrics",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "account metrics",
|
"description": "account metrics",
|
||||||
@ -1951,6 +1975,11 @@ func init() {
|
|||||||
"name": "envId",
|
"name": "envId",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -1983,6 +2012,11 @@ func init() {
|
|||||||
"name": "shrToken",
|
"name": "shrToken",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "duration",
|
||||||
|
"in": "query"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
|
@ -9,7 +9,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetAccountMetricsParams creates a new GetAccountMetricsParams object
|
// NewGetAccountMetricsParams creates a new GetAccountMetricsParams object
|
||||||
@ -28,6 +31,11 @@ type GetAccountMetricsParams struct {
|
|||||||
|
|
||||||
// HTTP Request Object
|
// HTTP Request Object
|
||||||
HTTPRequest *http.Request `json:"-"`
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: query
|
||||||
|
*/
|
||||||
|
Duration *float64
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||||
@ -39,8 +47,37 @@ func (o *GetAccountMetricsParams) BindRequest(r *http.Request, route *middleware
|
|||||||
|
|
||||||
o.HTTPRequest = r
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
qs := runtime.Values(r.URL.Query())
|
||||||
|
|
||||||
|
qDuration, qhkDuration, _ := qs.GetOK("duration")
|
||||||
|
if err := o.bindDuration(qDuration, qhkDuration, route.Formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
if len(res) > 0 {
|
if len(res) > 0 {
|
||||||
return errors.CompositeValidationError(res...)
|
return errors.CompositeValidationError(res...)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bindDuration binds and validates parameter Duration from query.
|
||||||
|
func (o *GetAccountMetricsParams) bindDuration(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
|
var raw string
|
||||||
|
if len(rawData) > 0 {
|
||||||
|
raw = rawData[len(rawData)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required: false
|
||||||
|
// AllowEmptyValue: false
|
||||||
|
|
||||||
|
if raw == "" { // empty values pass all other validations
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
value, err := swag.ConvertFloat64(raw)
|
||||||
|
if err != nil {
|
||||||
|
return errors.InvalidType("duration", "query", "float64", raw)
|
||||||
|
}
|
||||||
|
o.Duration = &value
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -9,11 +9,17 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/url"
|
"net/url"
|
||||||
golangswaggerpaths "path"
|
golangswaggerpaths "path"
|
||||||
|
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetAccountMetricsURL generates an URL for the get account metrics operation
|
// GetAccountMetricsURL generates an URL for the get account metrics operation
|
||||||
type GetAccountMetricsURL struct {
|
type GetAccountMetricsURL struct {
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
_basePath string
|
_basePath string
|
||||||
|
// avoid unkeyed usage
|
||||||
|
_ struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||||
@ -43,6 +49,18 @@ func (o *GetAccountMetricsURL) Build() (*url.URL, error) {
|
|||||||
}
|
}
|
||||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||||
|
|
||||||
|
qs := make(url.Values)
|
||||||
|
|
||||||
|
var durationQ string
|
||||||
|
if o.Duration != nil {
|
||||||
|
durationQ = swag.FormatFloat64(*o.Duration)
|
||||||
|
}
|
||||||
|
if durationQ != "" {
|
||||||
|
qs.Set("duration", durationQ)
|
||||||
|
}
|
||||||
|
|
||||||
|
_result.RawQuery = qs.Encode()
|
||||||
|
|
||||||
return &_result, nil
|
return &_result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetEnvironmentMetricsParams creates a new GetEnvironmentMetricsParams object
|
// NewGetEnvironmentMetricsParams creates a new GetEnvironmentMetricsParams object
|
||||||
@ -30,6 +32,10 @@ type GetEnvironmentMetricsParams struct {
|
|||||||
// HTTP Request Object
|
// HTTP Request Object
|
||||||
HTTPRequest *http.Request `json:"-"`
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: query
|
||||||
|
*/
|
||||||
|
Duration *float64
|
||||||
/*
|
/*
|
||||||
Required: true
|
Required: true
|
||||||
In: path
|
In: path
|
||||||
@ -46,6 +52,13 @@ func (o *GetEnvironmentMetricsParams) BindRequest(r *http.Request, route *middle
|
|||||||
|
|
||||||
o.HTTPRequest = r
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
qs := runtime.Values(r.URL.Query())
|
||||||
|
|
||||||
|
qDuration, qhkDuration, _ := qs.GetOK("duration")
|
||||||
|
if err := o.bindDuration(qDuration, qhkDuration, route.Formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
rEnvID, rhkEnvID, _ := route.Params.GetOK("envId")
|
rEnvID, rhkEnvID, _ := route.Params.GetOK("envId")
|
||||||
if err := o.bindEnvID(rEnvID, rhkEnvID, route.Formats); err != nil {
|
if err := o.bindEnvID(rEnvID, rhkEnvID, route.Formats); err != nil {
|
||||||
res = append(res, err)
|
res = append(res, err)
|
||||||
@ -56,6 +69,29 @@ func (o *GetEnvironmentMetricsParams) BindRequest(r *http.Request, route *middle
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bindDuration binds and validates parameter Duration from query.
|
||||||
|
func (o *GetEnvironmentMetricsParams) bindDuration(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
|
var raw string
|
||||||
|
if len(rawData) > 0 {
|
||||||
|
raw = rawData[len(rawData)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required: false
|
||||||
|
// AllowEmptyValue: false
|
||||||
|
|
||||||
|
if raw == "" { // empty values pass all other validations
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
value, err := swag.ConvertFloat64(raw)
|
||||||
|
if err != nil {
|
||||||
|
return errors.InvalidType("duration", "query", "float64", raw)
|
||||||
|
}
|
||||||
|
o.Duration = &value
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindEnvID binds and validates parameter EnvID from path.
|
// bindEnvID binds and validates parameter EnvID from path.
|
||||||
func (o *GetEnvironmentMetricsParams) bindEnvID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
func (o *GetEnvironmentMetricsParams) bindEnvID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
var raw string
|
var raw string
|
||||||
|
@ -10,12 +10,16 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
golangswaggerpaths "path"
|
golangswaggerpaths "path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetEnvironmentMetricsURL generates an URL for the get environment metrics operation
|
// GetEnvironmentMetricsURL generates an URL for the get environment metrics operation
|
||||||
type GetEnvironmentMetricsURL struct {
|
type GetEnvironmentMetricsURL struct {
|
||||||
EnvID string
|
EnvID string
|
||||||
|
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
_basePath string
|
_basePath string
|
||||||
// avoid unkeyed usage
|
// avoid unkeyed usage
|
||||||
_ struct{}
|
_ struct{}
|
||||||
@ -55,6 +59,18 @@ func (o *GetEnvironmentMetricsURL) Build() (*url.URL, error) {
|
|||||||
}
|
}
|
||||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||||
|
|
||||||
|
qs := make(url.Values)
|
||||||
|
|
||||||
|
var durationQ string
|
||||||
|
if o.Duration != nil {
|
||||||
|
durationQ = swag.FormatFloat64(*o.Duration)
|
||||||
|
}
|
||||||
|
if durationQ != "" {
|
||||||
|
qs.Set("duration", durationQ)
|
||||||
|
}
|
||||||
|
|
||||||
|
_result.RawQuery = qs.Encode()
|
||||||
|
|
||||||
return &_result, nil
|
return &_result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/go-openapi/errors"
|
"github.com/go-openapi/errors"
|
||||||
|
"github.com/go-openapi/runtime"
|
||||||
"github.com/go-openapi/runtime/middleware"
|
"github.com/go-openapi/runtime/middleware"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewGetShareMetricsParams creates a new GetShareMetricsParams object
|
// NewGetShareMetricsParams creates a new GetShareMetricsParams object
|
||||||
@ -30,6 +32,10 @@ type GetShareMetricsParams struct {
|
|||||||
// HTTP Request Object
|
// HTTP Request Object
|
||||||
HTTPRequest *http.Request `json:"-"`
|
HTTPRequest *http.Request `json:"-"`
|
||||||
|
|
||||||
|
/*
|
||||||
|
In: query
|
||||||
|
*/
|
||||||
|
Duration *float64
|
||||||
/*
|
/*
|
||||||
Required: true
|
Required: true
|
||||||
In: path
|
In: path
|
||||||
@ -46,6 +52,13 @@ func (o *GetShareMetricsParams) BindRequest(r *http.Request, route *middleware.M
|
|||||||
|
|
||||||
o.HTTPRequest = r
|
o.HTTPRequest = r
|
||||||
|
|
||||||
|
qs := runtime.Values(r.URL.Query())
|
||||||
|
|
||||||
|
qDuration, qhkDuration, _ := qs.GetOK("duration")
|
||||||
|
if err := o.bindDuration(qDuration, qhkDuration, route.Formats); err != nil {
|
||||||
|
res = append(res, err)
|
||||||
|
}
|
||||||
|
|
||||||
rShrToken, rhkShrToken, _ := route.Params.GetOK("shrToken")
|
rShrToken, rhkShrToken, _ := route.Params.GetOK("shrToken")
|
||||||
if err := o.bindShrToken(rShrToken, rhkShrToken, route.Formats); err != nil {
|
if err := o.bindShrToken(rShrToken, rhkShrToken, route.Formats); err != nil {
|
||||||
res = append(res, err)
|
res = append(res, err)
|
||||||
@ -56,6 +69,29 @@ func (o *GetShareMetricsParams) BindRequest(r *http.Request, route *middleware.M
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bindDuration binds and validates parameter Duration from query.
|
||||||
|
func (o *GetShareMetricsParams) bindDuration(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
|
var raw string
|
||||||
|
if len(rawData) > 0 {
|
||||||
|
raw = rawData[len(rawData)-1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required: false
|
||||||
|
// AllowEmptyValue: false
|
||||||
|
|
||||||
|
if raw == "" { // empty values pass all other validations
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
value, err := swag.ConvertFloat64(raw)
|
||||||
|
if err != nil {
|
||||||
|
return errors.InvalidType("duration", "query", "float64", raw)
|
||||||
|
}
|
||||||
|
o.Duration = &value
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// bindShrToken binds and validates parameter ShrToken from path.
|
// bindShrToken binds and validates parameter ShrToken from path.
|
||||||
func (o *GetShareMetricsParams) bindShrToken(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
func (o *GetShareMetricsParams) bindShrToken(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||||
var raw string
|
var raw string
|
||||||
|
@ -10,12 +10,16 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
golangswaggerpaths "path"
|
golangswaggerpaths "path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-openapi/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetShareMetricsURL generates an URL for the get share metrics operation
|
// GetShareMetricsURL generates an URL for the get share metrics operation
|
||||||
type GetShareMetricsURL struct {
|
type GetShareMetricsURL struct {
|
||||||
ShrToken string
|
ShrToken string
|
||||||
|
|
||||||
|
Duration *float64
|
||||||
|
|
||||||
_basePath string
|
_basePath string
|
||||||
// avoid unkeyed usage
|
// avoid unkeyed usage
|
||||||
_ struct{}
|
_ struct{}
|
||||||
@ -55,6 +59,18 @@ func (o *GetShareMetricsURL) Build() (*url.URL, error) {
|
|||||||
}
|
}
|
||||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||||
|
|
||||||
|
qs := make(url.Values)
|
||||||
|
|
||||||
|
var durationQ string
|
||||||
|
if o.Duration != nil {
|
||||||
|
durationQ = swag.FormatFloat64(*o.Duration)
|
||||||
|
}
|
||||||
|
if durationQ != "" {
|
||||||
|
qs.Set("duration", durationQ)
|
||||||
|
}
|
||||||
|
|
||||||
|
_result.RawQuery = qs.Encode()
|
||||||
|
|
||||||
return &_result, nil
|
return &_result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,6 +415,10 @@ paths:
|
|||||||
security:
|
security:
|
||||||
- key: []
|
- key: []
|
||||||
operationId: getAccountMetrics
|
operationId: getAccountMetrics
|
||||||
|
parameters:
|
||||||
|
- name: duration
|
||||||
|
in: query
|
||||||
|
type: number
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: account metrics
|
description: account metrics
|
||||||
@ -433,6 +437,9 @@ paths:
|
|||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
- name: duration
|
||||||
|
in: query
|
||||||
|
type: number
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: environment metrics
|
description: environment metrics
|
||||||
@ -453,6 +460,9 @@ paths:
|
|||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
- name: duration
|
||||||
|
in: query
|
||||||
|
type: number
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: share metrics
|
description: share metrics
|
||||||
|
@ -3,19 +3,34 @@
|
|||||||
import * as gateway from './gateway'
|
import * as gateway from './gateway'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param {object} options Optional options
|
||||||
|
* @param {number} [options.duration]
|
||||||
|
* @return {Promise<module:types.metrics>} account metrics
|
||||||
*/
|
*/
|
||||||
export function getAccountMetrics() {
|
export function getAccountMetrics(options) {
|
||||||
return gateway.request(getAccountMetricsOperation)
|
if (!options) options = {}
|
||||||
|
const parameters = {
|
||||||
|
query: {
|
||||||
|
duration: options.duration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gateway.request(getAccountMetricsOperation, parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} envId
|
* @param {string} envId
|
||||||
|
* @param {object} options Optional options
|
||||||
|
* @param {number} [options.duration]
|
||||||
* @return {Promise<module:types.metrics>} environment metrics
|
* @return {Promise<module:types.metrics>} environment metrics
|
||||||
*/
|
*/
|
||||||
export function getEnvironmentMetrics(envId) {
|
export function getEnvironmentMetrics(envId, options) {
|
||||||
|
if (!options) options = {}
|
||||||
const parameters = {
|
const parameters = {
|
||||||
path: {
|
path: {
|
||||||
envId
|
envId
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
duration: options.duration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gateway.request(getEnvironmentMetricsOperation, parameters)
|
return gateway.request(getEnvironmentMetricsOperation, parameters)
|
||||||
@ -23,12 +38,18 @@ export function getEnvironmentMetrics(envId) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} shrToken
|
* @param {string} shrToken
|
||||||
|
* @param {object} options Optional options
|
||||||
|
* @param {number} [options.duration]
|
||||||
* @return {Promise<module:types.metrics>} share metrics
|
* @return {Promise<module:types.metrics>} share metrics
|
||||||
*/
|
*/
|
||||||
export function getShareMetrics(shrToken) {
|
export function getShareMetrics(shrToken, options) {
|
||||||
|
if (!options) options = {}
|
||||||
const parameters = {
|
const parameters = {
|
||||||
path: {
|
path: {
|
||||||
shrToken
|
shrToken
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
duration: options.duration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gateway.request(getShareMetricsOperation, parameters)
|
return gateway.request(getShareMetricsOperation, parameters)
|
||||||
|
@ -46,7 +46,7 @@ const SharesTab = (props) => {
|
|||||||
cell: row => {
|
cell: row => {
|
||||||
return <ResponsiveContainer width={"100%"} height={"100%"}>
|
return <ResponsiveContainer width={"100%"} height={"100%"}>
|
||||||
<AreaChart data={row.metrics}>
|
<AreaChart data={row.metrics}>
|
||||||
<Area type="basis" dataKey={(v) => v} stroke={"#231069"} fillOpacity={1} fill={"#655796"} isAnimationActive={false} dot={false} />
|
<Area type="basis" dataKey={(v) => v} stroke={"#777"} fillOpacity={0.5} fill={"#04adef"} isAnimationActive={false} dot={false} />
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ const ShareDetail = (props) => {
|
|||||||
metrics: row => (
|
metrics: row => (
|
||||||
<ResponsiveContainer width={"100%"} height={"100%"}>
|
<ResponsiveContainer width={"100%"} height={"100%"}>
|
||||||
<AreaChart data={row.value}>
|
<AreaChart data={row.value}>
|
||||||
<Area type="basis" dataKey={(v) => v} stroke={"#231069"} fillOpacity={1} fill={"#655796"} isAnimationActive={false} dot={false} />
|
<Area type="basis" dataKey={(v) => v} stroke={"#777"} fillOpacity={0.5} fill={"#04adef"} isAnimationActive={false} dot={false} />
|
||||||
</AreaChart>
|
</AreaChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
),
|
),
|
||||||
|
@ -21,8 +21,8 @@ const Network = (props) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const paintNode = (node, ctx) => {
|
const paintNode = (node, ctx) => {
|
||||||
let nodeColor = node.selected ? "#04adef" : "#9BF316";
|
let nodeColor = node.selected ? "#9BF316" : "#04adef";
|
||||||
let textColor = node.selected ? "white" : "black";
|
let textColor = node.selected ? "black" : "white";
|
||||||
|
|
||||||
ctx.textBaseline = "middle";
|
ctx.textBaseline = "middle";
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center";
|
||||||
|
@ -40,7 +40,7 @@ export const mergeGraph = (oldGraph, user, newOverview) => {
|
|||||||
newGraph.links.push({
|
newGraph.links.push({
|
||||||
target: accountNode.id,
|
target: accountNode.id,
|
||||||
source: envNode.id,
|
source: envNode.id,
|
||||||
color: "#9BF316"
|
color: "#04adef"
|
||||||
});
|
});
|
||||||
if(env.shares) {
|
if(env.shares) {
|
||||||
env.shares.forEach(shr => {
|
env.shares.forEach(shr => {
|
||||||
@ -60,7 +60,7 @@ export const mergeGraph = (oldGraph, user, newOverview) => {
|
|||||||
newGraph.links.push({
|
newGraph.links.push({
|
||||||
target: envNode.id,
|
target: envNode.id,
|
||||||
source: shrNode.id,
|
source: shrNode.id,
|
||||||
color: "#9BF316"
|
color: "#04adef"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user