Skip to content

Commit a01480f

Browse files
authored
Merge pull request #1378 from ioito/hotfix/qx-ssl-create
fix: ssl create
2 parents 4e51404 + 8621a44 commit a01480f

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

pkg/cloudprovider/cloudprovider.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ type ICloudProvider interface {
310310
GetMetrics(opts *MetricListOptions) ([]MetricValues, error)
311311

312312
GetISSLCertificates() ([]ICloudSSLCertificate, error)
313+
CreateISSLCertificate(opts *SSLCertificateCreateOptions) (ICloudSSLCertificate, error)
313314

314315
GetIAiGateways() ([]IAiGateway, error)
315316
GetIAiGatewayById(id string) (IAiGateway, error)
@@ -643,6 +644,10 @@ func (base *SBaseProvider) GetISSLCertificates() ([]ICloudSSLCertificate, error)
643644
return nil, errors.Wrapf(ErrNotImplemented, "GetISSLCertificates")
644645
}
645646

647+
func (base *SBaseProvider) CreateISSLCertificate(opts *SSLCertificateCreateOptions) (ICloudSSLCertificate, error) {
648+
return nil, errors.Wrapf(ErrNotImplemented, "CreateISSLCertificate")
649+
}
650+
646651
func (base *SBaseProvider) GetIAiGateways() ([]IAiGateway, error) {
647652
return nil, errors.Wrapf(ErrNotImplemented, "GetIAiGateways")
648653
}

pkg/cloudprovider/resources.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,6 @@ type ICloudSSLCertificate interface {
18141814
GetCommon() string
18151815
GetCountry() string
18161816
GetIssuer() string
1817-
GetExpired() bool
18181817
GetEndDate() time.Time
18191818
GetFingerprint() string
18201819
GetCity() string

pkg/cloudprovider/ssl.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2019 Yunion
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package cloudprovider
16+
17+
const (
18+
SSL_ISSUER_LETSENCRYPT = "Let's Encrypt"
19+
SSL_ISSUER_ZEROSSL = "ZeroSSL"
20+
)
21+
22+
type SSLCertificateCreateOptions struct {
23+
Certificate string
24+
PrivateKey string
25+
}

pkg/multicloud/aliyun/sslcertificate.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ func (s *SSSLCertificate) GetIssuer() string {
5959
return s.Issuer
6060
}
6161

62-
func (s *SSSLCertificate) GetExpired() bool {
63-
return s.Expired
64-
}
65-
6662
func (s *SSSLCertificate) GetEndDate() time.Time {
6763
return s.EndDate
6864
}

pkg/multicloud/huawei/sslcertificate.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010
"time"
1111

12+
"yunion.io/x/cloudmux/pkg/apis"
1213
"yunion.io/x/cloudmux/pkg/multicloud"
1314
"yunion.io/x/pkg/errors"
1415
)
@@ -66,10 +67,6 @@ func (s *SSSLCertificate) GetIssuer() string {
6667
return s.Brand
6768
}
6869

69-
func (s *SSSLCertificate) GetExpired() bool {
70-
return time.Now().After(s.GetEndDate())
71-
}
72-
7370
func (s *SSSLCertificate) GetEndDate() time.Time {
7471
t, _ := time.Parse("2006-01-02 15:04:05", s.ExpireTime)
7572
return t
@@ -111,11 +108,7 @@ func (s *SSSLCertificate) GetGlobalId() string {
111108
}
112109

113110
func (s *SSSLCertificate) GetStatus() string {
114-
if s.GetExpired() {
115-
return "expired"
116-
} else {
117-
return "normal"
118-
}
111+
return apis.STATUS_AVAILABLE
119112
}
120113

121114
func (s *SSSLCertificate) GetIsUpload() bool {

pkg/multicloud/qcloud/certificate.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,6 @@ func (self *SCertificate) GetIssuer() string {
220220
return self.ProductZhName
221221
}
222222

223-
func (self *SCertificate) GetExpired() bool {
224-
if self.Status == 3 {
225-
return true
226-
} else {
227-
return false
228-
}
229-
}
230-
231223
func (self *SCertificate) GetEndDate() time.Time {
232224
return self.CERTEndTime
233225
}

0 commit comments

Comments
 (0)