-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
605 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package shell | ||
|
||
import ( | ||
"yunion.io/x/onecloud/pkg/mcclient" | ||
"yunion.io/x/onecloud/pkg/mcclient/modules" | ||
"yunion.io/x/onecloud/pkg/mcclient/options" | ||
) | ||
|
||
func init() { | ||
R(&options.ServiceCertificateCreateOptions{}, "service-cert-create", "Create service cert", func(s *mcclient.ClientSession, opts *options.ServiceCertificateCreateOptions) error { | ||
params, err := opts.Params() | ||
if err != nil { | ||
return err | ||
} | ||
cert, err := modules.ServiceCertificatesV3.Create(s, params) | ||
if err != nil { | ||
return err | ||
} | ||
printObject(cert) | ||
return nil | ||
}) | ||
type ServiceCertificateGetOptions struct { | ||
ID string `json:"-"` | ||
} | ||
R(&ServiceCertificateGetOptions{}, "service-cert-show", "Show service cert", func(s *mcclient.ClientSession, opts *ServiceCertificateGetOptions) error { | ||
cert, err := modules.ServiceCertificatesV3.Get(s, opts.ID, nil) | ||
if err != nil { | ||
return err | ||
} | ||
printObject(cert) | ||
return nil | ||
}) | ||
|
||
type ServiceCertificateListOptions struct { | ||
options.BaseListOptions | ||
} | ||
R(&ServiceCertificateListOptions{}, "service-cert-list", "List service certs", func(s *mcclient.ClientSession, opts *ServiceCertificateListOptions) error { | ||
params, err := options.ListStructToParams(opts) | ||
if err != nil { | ||
return err | ||
} | ||
result, err := modules.ServiceCertificatesV3.List(s, params) | ||
if err != nil { | ||
return err | ||
} | ||
printList(result, modules.ServiceCertificatesV3.GetColumns(s)) | ||
return nil | ||
}) | ||
type ServiceCertificateDeleteOptions struct { | ||
ID string `json:"-"` | ||
} | ||
R(&ServiceCertificateDeleteOptions{}, "service-cert-delete", "Delete service cert", func(s *mcclient.ClientSession, opts *ServiceCertificateDeleteOptions) error { | ||
cert, err := modules.ServiceCertificatesV3.Delete(s, opts.ID, nil) | ||
if err != nil { | ||
return err | ||
} | ||
printObject(cert) | ||
return nil | ||
}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package db | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type SCertificateResourceBase struct { | ||
Certificate string `create:"required" list:"user" update:"user"` | ||
PrivateKey string `create:"required" list:"admin" update:"user"` | ||
|
||
// derived attributes | ||
PublicKeyAlgorithm string `create:"optional" list:"user" update:"user"` | ||
PublicKeyBitLen int `create:"optional" list:"user" update:"user"` | ||
SignatureAlgorithm string `create:"optional" list:"user" update:"user"` | ||
Fingerprint string `create:"optional" list:"user" update:"user"` | ||
NotBefore time.Time `create:"optional" list:"user" update:"user"` | ||
NotAfter time.Time `create:"optional" list:"user" update:"user"` | ||
CommonName string `create:"optional" list:"user" update:"user"` | ||
SubjectAlternativeNames string `create:"optional" list:"user" update:"user"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.