Skip to content

Commit

Permalink
feat: adds fields to backup_compliance_policy. (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosuma committed Nov 22, 2023
1 parent f174cc6 commit 9505939
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mongodbatlas/backup_compliance_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ var _ BackupCompliancePolicyService = &BackupCompliancePolicyServiceOp{}
// BackupCompliancePolicy represents a backup compiance policy.
type BackupCompliancePolicy struct {
AuthorizedEmail string `json:"authorizedEmail,omitempty"`
AuthorizedUserFirstName string `json:"authorizedUserFirstName,omitempty"`
AuthorizedUserLastName string `json:"authorizedUserLastName,omitempty"`
CopyProtectionEnabled *bool `json:"copyProtectionEnabled,omitempty"`
EncryptionAtRestEnabled *bool `json:"encryptionAtRestEnabled,omitempty"`
OnDemandPolicyItem PolicyItem `json:"onDemandPolicyItem,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions mongodbatlas/backup_compliance_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func TestBackupCompliancePolicy_Get(t *testing.T) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{
"authorizedEmail": "user@example.com",
"authorizedUserFirstName": "first",
"authorizedUserLastName": "last",
"copyProtectionEnabled": false,
"encryptionAtRestEnabled": false,
"onDemandPolicyItem":
Expand Down Expand Up @@ -76,6 +78,8 @@ func TestBackupCompliancePolicy_Get(t *testing.T) {

expected := &BackupCompliancePolicy{
AuthorizedEmail: "user@example.com",
AuthorizedUserFirstName: "first",
AuthorizedUserLastName: "last",
CopyProtectionEnabled: pointer(false),
EncryptionAtRestEnabled: pointer(false),
ProjectID: "32b6e34b3d91647abb20e7b8",
Expand Down Expand Up @@ -125,6 +129,8 @@ func TestBackupCompliancePolicy_Update(t *testing.T) {
mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
expected := map[string]interface{}{
"authorizedEmail": "user@example.com",
"authorizedUserFirstName": "first",
"authorizedUserLastName": "last",
"copyProtectionEnabled": false,
"encryptionAtRestEnabled": false,
"updatedDate": "2019-08-24T14:15:22Z",
Expand Down Expand Up @@ -170,6 +176,8 @@ func TestBackupCompliancePolicy_Update(t *testing.T) {

fmt.Fprint(w, `{
"authorizedEmail": "user@example.com",
"authorizedUserFirstName": "first",
"authorizedUserLastName": "last",
"copyProtectionEnabled": false,
"encryptionAtRestEnabled": false,
"onDemandPolicyItem":
Expand Down Expand Up @@ -208,6 +216,8 @@ func TestBackupCompliancePolicy_Update(t *testing.T) {

updateRequest := &BackupCompliancePolicy{
AuthorizedEmail: "user@example.com",
AuthorizedUserFirstName: "first",
AuthorizedUserLastName: "last",
CopyProtectionEnabled: pointer(false),
EncryptionAtRestEnabled: pointer(false),
ProjectID: "32b6e34b3d91647abb20e7b8",
Expand Down Expand Up @@ -248,6 +258,8 @@ func TestBackupCompliancePolicy_Update(t *testing.T) {

expected := &BackupCompliancePolicy{
AuthorizedEmail: "user@example.com",
AuthorizedUserFirstName: "first",
AuthorizedUserLastName: "last",
CopyProtectionEnabled: pointer(false),
EncryptionAtRestEnabled: pointer(false),
ProjectID: "32b6e34b3d91647abb20e7b8",
Expand Down

0 comments on commit 9505939

Please sign in to comment.