diff --git a/api/apidocs-user.json b/api/apidocs-user.json index 2e897b40..3ef5ab7a 100644 --- a/api/apidocs-user.json +++ b/api/apidocs-user.json @@ -6082,6 +6082,13 @@ "ports" : { "description" : "The ports that allow communication with the cluster using various protocols.", "$ref" : "#/definitions/ClusterMetadataPortInfo" + }, + "services_urls" : { + "type" : "array", + "description" : "A list of the URLs to access services that the resource provides at this time. Note that if the service is not running or has not started yet, the URL to access it won't be available", + "items" : { + "$ref" : "#/definitions/ServiceUrl" + } } }, "description" : "Information about the public and internal state, and the configuration settings of an Elasticsearch cluster." @@ -9806,6 +9813,21 @@ }, "description" : "An Elasticsearch search request with a subset of options." }, + "ServiceUrl" : { + "type" : "object", + "required" : [ "service", "url" ], + "properties" : { + "service" : { + "type" : "string", + "description" : "Name of the service" + }, + "url" : { + "type" : "string", + "description" : "The full URL to access the service" + } + }, + "description" : "A URL to access the service of a resource" + }, "SnapshotStatusInfo" : { "type" : "object", "required" : [ "count", "healthy", "recent_success" ], diff --git a/api/apidocs.json b/api/apidocs.json index f7f3fb8e..0d424d2f 100644 --- a/api/apidocs.json +++ b/api/apidocs.json @@ -8459,7 +8459,14 @@ "summary" : "Resynchronize Deployments", "description" : "Resynchronizes the search index for all the deployments.", "operationId" : "resync-deployments", - "parameters" : [ ], + "parameters" : [ { + "name" : "skip_matching_version", + "in" : "query", + "description" : "When true, skips the document indexing when the version matches the in-memory copy.", + "required" : false, + "type" : "boolean", + "default" : true + } ], "responses" : { "200" : { "description" : "The deployments resync operation executed successfully.", @@ -25343,6 +25350,13 @@ "ports" : { "description" : "The ports that allow communication with the cluster using various protocols.", "$ref" : "#/definitions/ClusterMetadataPortInfo" + }, + "services_urls" : { + "type" : "array", + "description" : "A list of the URLs to access services that the resource provides at this time. Note that if the service is not running or has not started yet, the URL to access it won't be available", + "items" : { + "$ref" : "#/definitions/ServiceUrl" + } } }, "description" : "Information about the public and internal state, and the configuration settings of an Elasticsearch cluster." @@ -32832,6 +32846,21 @@ }, "description" : "A reorder request for Elasticsearch security realms." }, + "ServiceUrl" : { + "type" : "object", + "required" : [ "service", "url" ], + "properties" : { + "service" : { + "type" : "string", + "description" : "Name of the service" + }, + "url" : { + "type" : "string", + "description" : "The full URL to access the service" + } + }, + "description" : "A URL to access the service of a resource" + }, "SnapshotRepositoryConfiguration" : { "type" : "object", "required" : [ "settings", "type" ], diff --git a/pkg/client/deployments/resync_deployments_parameters.go b/pkg/client/deployments/resync_deployments_parameters.go index a0526013..5811e1fa 100644 --- a/pkg/client/deployments/resync_deployments_parameters.go +++ b/pkg/client/deployments/resync_deployments_parameters.go @@ -31,6 +31,7 @@ import ( "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" ) // NewResyncDeploymentsParams creates a new ResyncDeploymentsParams object, @@ -75,6 +76,15 @@ func NewResyncDeploymentsParamsWithHTTPClient(client *http.Client) *ResyncDeploy Typically these are written to a http.Request. */ type ResyncDeploymentsParams struct { + + /* SkipMatchingVersion. + + When true, skips the document indexing when the version matches the in-memory copy. + + Default: true + */ + SkipMatchingVersion *bool + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -92,7 +102,18 @@ func (o *ResyncDeploymentsParams) WithDefaults() *ResyncDeploymentsParams { // // All values with no default are reset to their zero value. func (o *ResyncDeploymentsParams) SetDefaults() { - // no default values defined for this parameter + var ( + skipMatchingVersionDefault = bool(true) + ) + + val := ResyncDeploymentsParams{ + SkipMatchingVersion: &skipMatchingVersionDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val } // WithTimeout adds the timeout to the resync deployments params @@ -128,6 +149,17 @@ func (o *ResyncDeploymentsParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } +// WithSkipMatchingVersion adds the skipMatchingVersion to the resync deployments params +func (o *ResyncDeploymentsParams) WithSkipMatchingVersion(skipMatchingVersion *bool) *ResyncDeploymentsParams { + o.SetSkipMatchingVersion(skipMatchingVersion) + return o +} + +// SetSkipMatchingVersion adds the skipMatchingVersion to the resync deployments params +func (o *ResyncDeploymentsParams) SetSkipMatchingVersion(skipMatchingVersion *bool) { + o.SkipMatchingVersion = skipMatchingVersion +} + // WriteToRequest writes these params to a swagger request func (o *ResyncDeploymentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -136,6 +168,23 @@ func (o *ResyncDeploymentsParams) WriteToRequest(r runtime.ClientRequest, reg st } var res []error + if o.SkipMatchingVersion != nil { + + // query param skip_matching_version + var qrSkipMatchingVersion bool + + if o.SkipMatchingVersion != nil { + qrSkipMatchingVersion = *o.SkipMatchingVersion + } + qSkipMatchingVersion := swag.FormatBool(qrSkipMatchingVersion) + if qSkipMatchingVersion != "" { + + if err := r.SetQueryParam("skip_matching_version", qSkipMatchingVersion); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/pkg/models/cluster_metadata_info.go b/pkg/models/cluster_metadata_info.go index 1ecb8201..30a7f04d 100644 --- a/pkg/models/cluster_metadata_info.go +++ b/pkg/models/cluster_metadata_info.go @@ -24,6 +24,7 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -62,6 +63,9 @@ type ClusterMetadataInfo struct { // The full URL to access this deployment resource ServiceURL string `json:"service_url,omitempty"` + // A list of the URLs to access services that the resource provides at this time. Note that if the service is not running or has not started yet, the URL to access it won't be available + ServicesUrls []*ServiceURL `json:"services_urls"` + // The resource version number of the cluster metadata // Required: true Version *int32 `json:"version"` @@ -79,6 +83,10 @@ func (m *ClusterMetadataInfo) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateServicesUrls(formats); err != nil { + res = append(res, err) + } + if err := m.validateVersion(formats); err != nil { res = append(res, err) } @@ -119,6 +127,30 @@ func (m *ClusterMetadataInfo) validatePorts(formats strfmt.Registry) error { return nil } +func (m *ClusterMetadataInfo) validateServicesUrls(formats strfmt.Registry) error { + if swag.IsZero(m.ServicesUrls) { // not required + return nil + } + + for i := 0; i < len(m.ServicesUrls); i++ { + if swag.IsZero(m.ServicesUrls[i]) { // not required + continue + } + + if m.ServicesUrls[i] != nil { + if err := m.ServicesUrls[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services_urls" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *ClusterMetadataInfo) validateVersion(formats strfmt.Registry) error { if err := validate.Required("version", "body", m.Version); err != nil { @@ -136,6 +168,10 @@ func (m *ClusterMetadataInfo) ContextValidate(ctx context.Context, formats strfm res = append(res, err) } + if err := m.contextValidateServicesUrls(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -156,6 +192,24 @@ func (m *ClusterMetadataInfo) contextValidatePorts(ctx context.Context, formats return nil } +func (m *ClusterMetadataInfo) contextValidateServicesUrls(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ServicesUrls); i++ { + + if m.ServicesUrls[i] != nil { + if err := m.ServicesUrls[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services_urls" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ClusterMetadataInfo) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/pkg/models/service_url.go b/pkg/models/service_url.go new file mode 100644 index 00000000..de8fc79c --- /dev/null +++ b/pkg/models/service_url.go @@ -0,0 +1,105 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you 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. + +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ServiceURL A URL to access the service of a resource +// +// swagger:model ServiceUrl +type ServiceURL struct { + + // Name of the service + // Required: true + Service *string `json:"service"` + + // The full URL to access the service + // Required: true + URL *string `json:"url"` +} + +// Validate validates this service Url +func (m *ServiceURL) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateService(formats); err != nil { + res = append(res, err) + } + + if err := m.validateURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceURL) validateService(formats strfmt.Registry) error { + + if err := validate.Required("service", "body", m.Service); err != nil { + return err + } + + return nil +} + +func (m *ServiceURL) validateURL(formats strfmt.Registry) error { + + if err := validate.Required("url", "body", m.URL); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this service Url based on context it is used +func (m *ServiceURL) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceURL) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceURL) UnmarshalBinary(b []byte) error { + var res ServiceURL + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}