Skip to content

Commit 6aa1a49

Browse files
authored
Merge pull request #48 from IBM/haim
User-provided CSR
2 parents dbfaa7b + b6239fa commit 6aa1a49

File tree

3 files changed

+89
-4
lines changed

3 files changed

+89
-4
lines changed

common/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
package common
1818

1919
// Version of the SDK
20-
const Version = "1.0.47"
20+
const Version = "1.0.48"

secretsmanagerv1/secrets_manager_v1.go

Lines changed: 82 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/*
18-
* IBM OpenAPI SDK Code Generator Version: 3.60.0-13f6e1ba-20221019-164457
18+
* IBM OpenAPI SDK Code Generator Version: 3.60.2-95dc7721-20221102-203229
1919
*/
2020

2121
// Package secretsmanagerv1 : Operations and models for the SecretsManagerV1 service
@@ -6923,6 +6923,7 @@ func UnmarshalRotation(m map[string]json.RawMessage, result interface{}) (err er
69236923
// - RotateUsernamePasswordSecretBody
69246924
// - RotateCertificateBody
69256925
// - RotatePrivateCertBody
6926+
// - RotatePrivateCertBodyWithCsr
69266927
// - RotatePrivateCertBodyWithVersionCustomMetadata
69276928
// - RestoreIamCredentialsSecretBody
69286929
// - DeleteCredentialsForIamCredentialsSecret
@@ -6952,6 +6953,12 @@ type SecretAction struct {
69526953
// The new intermediate certificate to associate with the certificate.
69536954
Intermediate *string `json:"intermediate,omitempty"`
69546955

6956+
// The certificate signing request. If you provide a CSR, it is used for auto rotation and manual rotation requests
6957+
// that do not include a CSR. If you don't include the CSR, the certificate is generated with the last CSR that you
6958+
// provided to create the private certificate, or on a previous request to rotate the certificate. If no CSR was
6959+
// provided in the past, the certificate is generated with a CSR that is created internally.
6960+
Csr *string `json:"csr,omitempty"`
6961+
69556962
// The ID of the target version or the alias `previous`.
69566963
VersionID *string `json:"version_id,omitempty"`
69576964

@@ -7010,6 +7017,10 @@ func UnmarshalSecretAction(m map[string]json.RawMessage, result interface{}) (er
70107017
if err != nil {
70117018
return
70127019
}
7020+
err = core.UnmarshalPrimitive(m, "csr", &obj.Csr)
7021+
if err != nil {
7022+
return
7023+
}
70137024
err = core.UnmarshalPrimitive(m, "version_id", &obj.VersionID)
70147025
if err != nil {
70157026
return
@@ -8101,6 +8112,11 @@ type SecretResource struct {
81018112
// The intermediate certificate authority that signed this certificate.
81028113
CertificateAuthority *string `json:"certificate_authority,omitempty"`
81038114

8115+
// The certificate signing request. If you don't include this parameter, the CSR that is used to generate the
8116+
// certificate is created internally. If you provide a CSR, it is used also for auto rotation and manual rotation,
8117+
// unless you provide another CSR in the manual rotation request.
8118+
Csr *string `json:"csr,omitempty"`
8119+
81048120
// The IP Subject Alternative Names to define for the CA certificate, in a comma-delimited list.
81058121
IPSans *string `json:"ip_sans,omitempty"`
81068122

@@ -8366,6 +8382,10 @@ func UnmarshalSecretResource(m map[string]json.RawMessage, result interface{}) (
83668382
if err != nil {
83678383
return
83688384
}
8385+
err = core.UnmarshalPrimitive(m, "csr", &obj.Csr)
8386+
if err != nil {
8387+
return
8388+
}
83698389
err = core.UnmarshalPrimitive(m, "ip_sans", &obj.IPSans)
83708390
if err != nil {
83718391
return
@@ -13387,7 +13407,13 @@ type PrivateCertificateSecretResource struct {
1338713407
// The intermediate certificate authority that signed this certificate.
1338813408
CertificateAuthority *string `json:"certificate_authority,omitempty"`
1338913409

13390-
// The fully qualified domain name or host domain name for the certificate.
13410+
// The certificate signing request. If you don't include this parameter, the CSR that is used to generate the
13411+
// certificate is created internally. If you provide a CSR, it is used also for auto rotation and manual rotation,
13412+
// unless you provide another CSR in the manual rotation request.
13413+
Csr *string `json:"csr,omitempty"`
13414+
13415+
// The fully qualified domain name or host domain name for the certificate. If you provide a CSR that includes a common
13416+
// name value, the certificate is generated with the common name that is provided in the CSR.
1339113417
CommonName *string `json:"common_name" validate:"required"`
1339213418

1339313419
// The alternative names that are defined for the certificate.
@@ -13455,7 +13481,8 @@ type PrivateCertificateSecretResource struct {
1345513481
// The data that is associated with the secret. The data object contains the following fields:
1345613482
//
1345713483
// - `certificate`: The contents of the certificate.
13458-
// - `private_key`: The private key that is associated with the certificate.
13484+
// - `private_key`: The private key that is associated with the certificate. If you provide a CSR in the request, the
13485+
// private_key field is not included in the data.
1345913486
// - `issuing_ca`: The certificate of the certificate authority that signed and issued this certificate.
1346013487
// - `ca_chain`: The chain of certificate authorities that are associated with the certificate.
1346113488
SecretData map[string]interface{} `json:"secret_data,omitempty"`
@@ -13581,6 +13608,10 @@ func UnmarshalPrivateCertificateSecretResource(m map[string]json.RawMessage, res
1358113608
if err != nil {
1358213609
return
1358313610
}
13611+
err = core.UnmarshalPrimitive(m, "csr", &obj.Csr)
13612+
if err != nil {
13613+
return
13614+
}
1358413615
err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName)
1358513616
if err != nil {
1358613617
return
@@ -15231,6 +15262,54 @@ func UnmarshalRotatePrivateCertBody(m map[string]json.RawMessage, result interfa
1523115262
return
1523215263
}
1523315264

15265+
// RotatePrivateCertBodyWithCsr : The body of a request to rotate a private certificate.
15266+
// This model "extends" SecretAction
15267+
type RotatePrivateCertBodyWithCsr struct {
15268+
// The certificate signing request. If you provide a CSR, it is used for auto rotation and manual rotation requests
15269+
// that do not include a CSR. If you don't include the CSR, the certificate is generated with the last CSR that you
15270+
// provided to create the private certificate, or on a previous request to rotate the certificate. If no CSR was
15271+
// provided in the past, the certificate is generated with a CSR that is created internally.
15272+
Csr *string `json:"csr" validate:"required"`
15273+
15274+
// The secret metadata that a user can customize.
15275+
CustomMetadata map[string]interface{} `json:"custom_metadata,omitempty"`
15276+
15277+
// The secret version metadata that a user can customize.
15278+
VersionCustomMetadata map[string]interface{} `json:"version_custom_metadata,omitempty"`
15279+
}
15280+
15281+
// NewRotatePrivateCertBodyWithCsr : Instantiate RotatePrivateCertBodyWithCsr (Generic Model Constructor)
15282+
func (*SecretsManagerV1) NewRotatePrivateCertBodyWithCsr(csr string) (_model *RotatePrivateCertBodyWithCsr, err error) {
15283+
_model = &RotatePrivateCertBodyWithCsr{
15284+
Csr: core.StringPtr(csr),
15285+
}
15286+
err = core.ValidateStruct(_model, "required parameters")
15287+
return
15288+
}
15289+
15290+
func (*RotatePrivateCertBodyWithCsr) isaSecretAction() bool {
15291+
return true
15292+
}
15293+
15294+
// UnmarshalRotatePrivateCertBodyWithCsr unmarshals an instance of RotatePrivateCertBodyWithCsr from the specified map of raw messages.
15295+
func UnmarshalRotatePrivateCertBodyWithCsr(m map[string]json.RawMessage, result interface{}) (err error) {
15296+
obj := new(RotatePrivateCertBodyWithCsr)
15297+
err = core.UnmarshalPrimitive(m, "csr", &obj.Csr)
15298+
if err != nil {
15299+
return
15300+
}
15301+
err = core.UnmarshalPrimitive(m, "custom_metadata", &obj.CustomMetadata)
15302+
if err != nil {
15303+
return
15304+
}
15305+
err = core.UnmarshalPrimitive(m, "version_custom_metadata", &obj.VersionCustomMetadata)
15306+
if err != nil {
15307+
return
15308+
}
15309+
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
15310+
return
15311+
}
15312+
1523415313
// RotatePrivateCertBodyWithVersionCustomMetadata : The request body of a rotate private certificate action.
1523515314
// This model "extends" SecretAction
1523615315
type RotatePrivateCertBodyWithVersionCustomMetadata struct {

secretsmanagerv1/secrets_manager_v1_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10106,6 +10106,12 @@ var _ = Describe(`SecretsManagerV1`, func() {
1010610106
Expect(_model).ToNot(BeNil())
1010710107
Expect(err).To(BeNil())
1010810108
})
10109+
It(`Invoke NewRotatePrivateCertBodyWithCsr successfully`, func() {
10110+
csr := "testString"
10111+
_model, err := secretsManagerService.NewRotatePrivateCertBodyWithCsr(csr)
10112+
Expect(_model).ToNot(BeNil())
10113+
Expect(err).To(BeNil())
10114+
})
1010910115
It(`Invoke NewRotatePrivateCertBodyWithVersionCustomMetadata successfully`, func() {
1011010116
versionCustomMetadata := map[string]interface{}{"anyKey": "anyValue"}
1011110117
_model, err := secretsManagerService.NewRotatePrivateCertBodyWithVersionCustomMetadata(versionCustomMetadata)

0 commit comments

Comments
 (0)