Merge pull request #12841 from ioito/hotfix/qx-es-access-info

fix(region): add access info for es
This commit is contained in:
Zexi Li
2021-12-09 01:00:46 +08:00
committed by GitHub
7 changed files with 61 additions and 0 deletions
@@ -27,4 +27,5 @@ func init() {
cmd.Show(&compute.ElasticSearchIdOption{})
cmd.Delete(&compute.ElasticSearchIdOption{})
cmd.Perform("syncstatus", &compute.ElasticSearchIdOption{})
cmd.Get("access-info", &compute.ElasticSearchIdOption{})
}
+3
View File
@@ -49,3 +49,6 @@ type ElasticSearchListInput struct {
ManagedResourceListInput
VpcFilterListInput
}
type ElasticSearchAccessInfoInput struct {
}
+26
View File
@@ -0,0 +1,26 @@
// Copyright 2019 Yunion
//
// 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 cloudprovider
// +onecloud:model-api-gen
type ElasticSearchAccessInfo struct {
Domain string
PrivateDomain string
Vip string
Port int
PrivatePort int
KibanaUrl string
KibanaPrivateUrl string
}
+2
View File
@@ -1441,6 +1441,8 @@ type ICloudElasticSearch interface {
GetZoneId() string
IsMultiAz() bool
GetAccessInfo() (*ElasticSearchAccessInfo, error)
Delete() error
}
+8
View File
@@ -641,3 +641,11 @@ func (self *SElasticSearch) PerformSyncstatus(ctx context.Context, userCred mccl
return nil, StartResourceSyncStatusTask(ctx, userCred, self, "ElasticSearchSyncstatusTask", "")
}
func (self *SElasticSearch) GetDetailsAccessInfo(ctx context.Context, userCred mcclient.TokenCredential, input api.ElasticSearchAccessInfoInput) (*cloudprovider.ElasticSearchAccessInfo, error) {
iEs, err := self.GetIElasticSearch()
if err != nil {
return nil, err
}
return iEs.GetAccessInfo()
}
+10
View File
@@ -276,6 +276,16 @@ func (self *SElasticSearch) GetStatus() string {
}
}
func (self *SElasticSearch) GetAccessInfo() (*cloudprovider.ElasticSearchAccessInfo, error) {
return &cloudprovider.ElasticSearchAccessInfo{
Domain: self.PublicDomain,
PrivateDomain: self.Domain,
Port: self.PublicPort,
PrivatePort: self.Port,
KibanaUrl: self.KibanaDomain,
}, nil
}
func (self *SRegion) GetIElasticSearchs() ([]cloudprovider.ICloudElasticSearch, error) {
ret := []SElasticSearch{}
for {
+11
View File
@@ -264,6 +264,17 @@ func (self *SElasticSearch) Delete() error {
return self.region.DeleteElasticSearch(self.InstanceId)
}
func (self *SElasticSearch) GetAccessInfo() (*cloudprovider.ElasticSearchAccessInfo, error) {
return &cloudprovider.ElasticSearchAccessInfo{
Port: self.EsPort,
Vip: self.EsVip,
Domain: self.EsPublicUrl,
PrivateDomain: self.EsDomain,
KibanaUrl: self.KibanaUrl,
KibanaPrivateUrl: self.KibanaPrivateUrl,
}, nil
}
func (self *SRegion) GetIElasticSearchs() ([]cloudprovider.ICloudElasticSearch, error) {
ess := []SElasticSearch{}
for {