Skip to content

Commit

Permalink
fix: sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
Murphy-hub committed Feb 13, 2023
1 parent e406405 commit d5d9577
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 652 deletions.
1 change: 0 additions & 1 deletion api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ func Serve() *gin.Engine {
prefix.GET("/cert", helper.WrapH(handler.CertDetail))
prefix.GET("/units_forbid_query", helper.WrapH(handler.UnitsForbidQuery))
prefix.GET("/units_certs_list", helper.WrapH(handler.UnitsCertsList))
prefix.POST("/units_status", helper.WrapH(handler.UnitsStatus))
// Root CA Prohibit operation
if !core.Is.Config.Keymanager.SelfSign {
lifeCyclePrefix := prefix.Group("/lifecycle")
Expand Down
34 changes: 34 additions & 0 deletions database/mysql/cfssl-model/dao/ocsp_responses.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2022-present The Ztalab Authors.
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 dao

import (
"github.com/pkg/errors"
"gorm.io/gorm"

"github.com/ztdbp/ZACA/database/mysql/cfssl-model/model"
)

// GetOcspResponses
func GetOcspResponses(db *gorm.DB, argId string) (record *model.OcspResponses, err error) {
record = &model.OcspResponses{}
if err = db.Where("id = ?", argId).First(record).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
return nil, err
}

return record, nil
}
34 changes: 34 additions & 0 deletions database/mysql/cfssl-model/dao/self_keypair.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2022-present The Ztalab Authors.
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 dao

import (
"github.com/pkg/errors"
"gorm.io/gorm"

"github.com/ztdbp/ZACA/database/mysql/cfssl-model/model"
)

// GetSelfKeypair
func GetSelfKeypair(db *gorm.DB, argId uint32) (record *model.SelfKeypair, err error) {
record = &model.SelfKeypair{}
if err = db.Where("id = ?", argId).First(record).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
return nil, err
}

return record, nil
}
Loading

0 comments on commit d5d9577

Please sign in to comment.