Skip to content

Commit c34b8b7

Browse files
authored
Merge pull request #87 from IBM/shacharn-7602-version-expiration
Print expiration_date to secret's versions
2 parents bdaa3e5 + af58921 commit c34b8b7

File tree

4 files changed

+74
-23
lines changed

4 files changed

+74
-23
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# IBM Cloud Secrets Manager Go SDK
2-
32
A Go client library to interact with the [IBM Cloud® Secrets Manager APIs](https://cloud.ibm.com/apidocs/secrets-manager).
43

54
<details>

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/IBM/go-sdk-core/v5 v5.17.4
77
github.com/go-openapi/strfmt v0.22.1
88
github.com/onsi/ginkgo v1.16.5
9-
github.com/onsi/gomega v1.28.0
9+
github.com/onsi/gomega v1.31.1
1010
github.com/stretchr/testify v1.8.4
1111
)
1212

@@ -19,7 +19,7 @@ require (
1919
github.com/go-playground/locales v0.14.1 // indirect
2020
github.com/go-playground/universal-translator v0.18.1 // indirect
2121
github.com/go-playground/validator/v10 v10.19.0 // indirect
22-
github.com/google/go-cmp v0.5.9 // indirect
22+
github.com/google/go-cmp v0.6.0 // indirect
2323
github.com/google/uuid v1.6.0 // indirect
2424
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
2525
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
1313
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
1414
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
1515
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
16-
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
17-
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
16+
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
17+
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
1818
github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY=
1919
github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho=
2020
github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc=
@@ -42,8 +42,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
4242
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
4343
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
4444
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
45-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
46-
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
45+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
46+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
4747
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=
4848
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
4949
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -76,12 +76,12 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
7676
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
7777
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
7878
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
79-
github.com/onsi/ginkgo/v2 v2.12.0 h1:UIVDowFPwpg6yMUpPjGkYvf06K3RAiJXUhCxEwQVHRI=
80-
github.com/onsi/ginkgo/v2 v2.12.0/go.mod h1:ZNEzXISYlqpb8S36iN71ifqLi3vVD1rVJGvWRCJOUpQ=
79+
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
80+
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
8181
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
8282
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
83-
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
84-
github.com/onsi/gomega v1.28.0/go.mod h1:A1H2JE76sI14WIP57LMKj7FVfCHx3g3BcZVjJG8bjX8=
83+
github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
84+
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
8585
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
8686
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8787
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -126,8 +126,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
126126
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
127127
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
128128
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
129-
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
130-
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
129+
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
130+
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
131131
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
132132
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
133133
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

secretsmanagerv2/secrets_manager_v2.go

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

1717
/*
18-
* IBM OpenAPI SDK Code Generator Version: 3.93.0-c40121e6-20240729-182103
18+
* IBM OpenAPI SDK Code Generator Version: 3.94.1-71478489-20240820-161623
1919
*/
2020

2121
// Package secretsmanagerv2 : Operations and models for the SecretsManagerV2 service
@@ -477,7 +477,7 @@ func (secretsManager *SecretsManagerV2) UpdateSecretGroupWithContext(ctx context
477477
// Delete a secret group by specifying the ID of the secret group.
478478
//
479479
// **Note:** To delete a secret group, it must be empty. If you need to remove a secret group that contains secrets, you
480-
// must first [delete the secrets](#delete-secret) that are associated with the group.
480+
// must first delete the secrets that are associated with the group.
481481
func (secretsManager *SecretsManagerV2) DeleteSecretGroup(deleteSecretGroupOptions *DeleteSecretGroupOptions) (response *core.DetailedResponse, err error) {
482482
response, err = secretsManager.DeleteSecretGroupWithContext(context.Background(), deleteSecretGroupOptions)
483483
err = core.RepurposeSDKProblem(err, "")
@@ -701,8 +701,7 @@ func (secretsManager *SecretsManagerV2) ListSecretsWithContext(ctx context.Conte
701701
// Get a secret and its details by specifying the ID of the secret.
702702
//
703703
// A successful request returns the secret data that is associated with your secret, along with other metadata. To view
704-
// only the details of a specified secret without retrieving its value, use the [Get secret
705-
// metadata](#get-secret-metadata) operation.
704+
// only the details of a specified secret without retrieving its value, use the Get secret metadata operation.
706705
func (secretsManager *SecretsManagerV2) GetSecret(getSecretOptions *GetSecretOptions) (result SecretIntf, response *core.DetailedResponse, err error) {
707706
result, response, err = secretsManager.GetSecretWithContext(context.Background(), getSecretOptions)
708707
err = core.RepurposeSDKProblem(err, "")
@@ -1054,8 +1053,7 @@ func (secretsManager *SecretsManagerV2) CreateSecretActionWithContext(ctx contex
10541053
// Get a secret and its details by specifying the Name and Type of the secret.
10551054
//
10561055
// A successful request returns the secret data that is associated with your secret, along with other metadata. To view
1057-
// only the details of a specified secret without retrieving its value, use the [Get secret
1058-
// metadata](#get-secret-metadata) operation.
1056+
// only the details of a specified secret without retrieving its value, use the Get secret metadata operation.
10591057
func (secretsManager *SecretsManagerV2) GetSecretByNameType(getSecretByNameTypeOptions *GetSecretByNameTypeOptions) (result SecretIntf, response *core.DetailedResponse, err error) {
10601058
result, response, err = secretsManager.GetSecretByNameTypeWithContext(context.Background(), getSecretByNameTypeOptions)
10611059
err = core.RepurposeSDKProblem(err, "")
@@ -12984,6 +12982,10 @@ type IAMCredentialsSecretVersion struct {
1298412982
// A v4 UUID identifier.
1298512983
SecretID *string `json:"secret_id" validate:"required"`
1298612984

12985+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
12986+
// Arbitrary, username_password.
12987+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
12988+
1298712989
// The ID of the API key that is generated for this secret.
1298812990
ApiKeyID *string `json:"api_key_id,omitempty"`
1298912991

@@ -13094,6 +13096,11 @@ func UnmarshalIAMCredentialsSecretVersion(m map[string]json.RawMessage, result i
1309413096
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
1309513097
return
1309613098
}
13099+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
13100+
if err != nil {
13101+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
13102+
return
13103+
}
1309713104
err = core.UnmarshalPrimitive(m, "api_key_id", &obj.ApiKeyID)
1309813105
if err != nil {
1309913106
err = core.SDKErrorf(err, "", "api_key_id-error", common.GetComponentInfo())
@@ -13155,6 +13162,10 @@ type IAMCredentialsSecretVersionMetadata struct {
1315513162
// A v4 UUID identifier.
1315613163
SecretID *string `json:"secret_id" validate:"required"`
1315713164

13165+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
13166+
// Arbitrary, username_password.
13167+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
13168+
1315813169
// The ID of the API key that is generated for this secret.
1315913170
ApiKeyID *string `json:"api_key_id,omitempty"`
1316013171

@@ -13258,6 +13269,11 @@ func UnmarshalIAMCredentialsSecretVersionMetadata(m map[string]json.RawMessage,
1325813269
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
1325913270
return
1326013271
}
13272+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
13273+
if err != nil {
13274+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
13275+
return
13276+
}
1326113277
err = core.UnmarshalPrimitive(m, "api_key_id", &obj.ApiKeyID)
1326213278
if err != nil {
1326313279
err = core.SDKErrorf(err, "", "api_key_id-error", common.GetComponentInfo())
@@ -14121,7 +14137,7 @@ type ImportedCertificateVersion struct {
1412114137

1412214138
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
1412314139
// Arbitrary, username_password.
14124-
ExpirationDate *strfmt.DateTime `json:"expiration_date" validate:"required"`
14140+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
1412514141

1412614142
// The unique serial number that was assigned to a certificate by the issuing certificate authority.
1412714143
SerialNumber *string `json:"serial_number" validate:"required"`
@@ -14308,7 +14324,7 @@ type ImportedCertificateVersionMetadata struct {
1430814324

1430914325
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
1431014326
// Arbitrary, username_password.
14311-
ExpirationDate *strfmt.DateTime `json:"expiration_date" validate:"required"`
14327+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
1431214328

1431314329
// The unique serial number that was assigned to a certificate by the issuing certificate authority.
1431414330
SerialNumber *string `json:"serial_number" validate:"required"`
@@ -15106,6 +15122,10 @@ type KVSecretVersion struct {
1510615122
// A v4 UUID identifier.
1510715123
SecretID *string `json:"secret_id" validate:"required"`
1510815124

15125+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
15126+
// Arbitrary, username_password.
15127+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
15128+
1510915129
// The payload data of a key-value secret.
1511015130
Data map[string]interface{} `json:"data" validate:"required"`
1511115131
}
@@ -15199,6 +15219,11 @@ func UnmarshalKVSecretVersion(m map[string]json.RawMessage, result interface{})
1519915219
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
1520015220
return
1520115221
}
15222+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
15223+
if err != nil {
15224+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
15225+
return
15226+
}
1520215227
err = core.UnmarshalPrimitive(m, "data", &obj.Data)
1520315228
if err != nil {
1520415229
err = core.SDKErrorf(err, "", "data-error", common.GetComponentInfo())
@@ -15249,6 +15274,10 @@ type KVSecretVersionMetadata struct {
1524915274

1525015275
// A v4 UUID identifier.
1525115276
SecretID *string `json:"secret_id" validate:"required"`
15277+
15278+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
15279+
// Arbitrary, username_password.
15280+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
1525215281
}
1525315282

1525415283
// Constants associated with the KVSecretVersionMetadata.SecretType property.
@@ -15340,6 +15369,11 @@ func UnmarshalKVSecretVersionMetadata(m map[string]json.RawMessage, result inter
1534015369
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
1534115370
return
1534215371
}
15372+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
15373+
if err != nil {
15374+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
15375+
return
15376+
}
1534315377
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
1534415378
return
1534515379
}
@@ -21405,7 +21439,7 @@ type PrivateCertificateVersion struct {
2140521439

2140621440
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
2140721441
// Arbitrary, username_password.
21408-
ExpirationDate *strfmt.DateTime `json:"expiration_date" validate:"required"`
21442+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
2140921443

2141021444
// The unique serial number that was assigned to a certificate by the issuing certificate authority.
2141121445
SerialNumber *string `json:"serial_number" validate:"required"`
@@ -21677,7 +21711,7 @@ type PrivateCertificateVersionMetadata struct {
2167721711

2167821712
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
2167921713
// Arbitrary, username_password.
21680-
ExpirationDate *strfmt.DateTime `json:"expiration_date" validate:"required"`
21714+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
2168121715

2168221716
// The unique serial number that was assigned to a certificate by the issuing certificate authority.
2168321717
SerialNumber *string `json:"serial_number" validate:"required"`
@@ -26237,6 +26271,10 @@ type UsernamePasswordSecretVersion struct {
2623726271
// A v4 UUID identifier.
2623826272
SecretID *string `json:"secret_id" validate:"required"`
2623926273

26274+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
26275+
// Arbitrary, username_password.
26276+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
26277+
2624026278
// The username that is assigned to an `username_password` secret.
2624126279
Username *string `json:"username" validate:"required"`
2624226280

@@ -26333,6 +26371,11 @@ func UnmarshalUsernamePasswordSecretVersion(m map[string]json.RawMessage, result
2633326371
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
2633426372
return
2633526373
}
26374+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
26375+
if err != nil {
26376+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
26377+
return
26378+
}
2633626379
err = core.UnmarshalPrimitive(m, "username", &obj.Username)
2633726380
if err != nil {
2633826381
err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo())
@@ -26388,6 +26431,10 @@ type UsernamePasswordSecretVersionMetadata struct {
2638826431

2638926432
// A v4 UUID identifier.
2639026433
SecretID *string `json:"secret_id" validate:"required"`
26434+
26435+
// The date when the secret material expires. The date format follows the `RFC 3339` format. Supported secret types:
26436+
// Arbitrary, username_password.
26437+
ExpirationDate *strfmt.DateTime `json:"expiration_date,omitempty"`
2639126438
}
2639226439

2639326440
// Constants associated with the UsernamePasswordSecretVersionMetadata.SecretType property.
@@ -26479,6 +26526,11 @@ func UnmarshalUsernamePasswordSecretVersionMetadata(m map[string]json.RawMessage
2647926526
err = core.SDKErrorf(err, "", "secret_id-error", common.GetComponentInfo())
2648026527
return
2648126528
}
26529+
err = core.UnmarshalPrimitive(m, "expiration_date", &obj.ExpirationDate)
26530+
if err != nil {
26531+
err = core.SDKErrorf(err, "", "expiration_date-error", common.GetComponentInfo())
26532+
return
26533+
}
2648226534
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
2648326535
return
2648426536
}

0 commit comments

Comments
 (0)