Skip to content

Support DefenderForStorageSettings resource by adding default state#3007

Merged
thomas11 merged 4 commits into
masterfrom
tkappler/DefenderForStorageSettings
Jan 24, 2024
Merged

Support DefenderForStorageSettings resource by adding default state#3007
thomas11 merged 4 commits into
masterfrom
tkappler/DefenderForStorageSettings

Conversation

@thomas11

@thomas11 thomas11 commented Jan 10, 2024

Copy link
Copy Markdown
Contributor

Support DefenderForStorageSettings resource by adding the default state to reset it to on delete, since it doesn't have an actual delete operation.

Without the hard-coded exception in the last commit, the generated schema is incorrect. The cause is unrelated to the PR. What's happening is that the Azure spec is defined as such (unrelated properties omitted):

      "properties": {
        "isEnabled": {
          "type": "boolean",
          "description": "Indicates whether Defender for Storage is enabled on this storage account."
        },
        "sensitiveDataDiscovery": {
          "x-ms-client-flatten": true,
          "$ref": "#/definitions/SensitiveDataDiscoveryProperties"
        }
      }

Where SensitiveDataDiscoveryProperties is:

      "properties": {
        "isEnabled": {
          "type": "boolean",
          "description": "Indicates whether Sensitive Data Discovery should be enabled."
        }
      }

The nested object is annotated with x-ms-client-flatten, causing the object to be flattened, causing the two identical isEnabled properties to collide. #3016 will fix this in v3.

In the meantime, I added a manual exception.

Resolves #2996

@thomas11 thomas11 requested a review from a team January 10, 2024 16:26
@github-actions

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.

New resources:

  • security.DefenderForStorage

New functions:

  • security.getDefenderForStorage

@codecov

codecov Bot commented Jan 10, 2024

Copy link
Copy Markdown

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (78139dc) 60.64% compared to head (1fc6706) 60.65%.

Files Patch % Lines
provider/pkg/gen/properties.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3007   +/-   ##
=======================================
  Coverage   60.64%   60.65%           
=======================================
  Files          66       66           
  Lines       11019    11027    +8     
=======================================
+ Hits         6683     6688    +5     
- Misses       3788     3790    +2     
- Partials      548      549    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomas11 thomas11 marked this pull request as draft January 10, 2024 22:03
@thomas11 thomas11 force-pushed the tkappler/DefenderForStorageSettings branch from d6f0a71 to 1fc6706 Compare January 23, 2024 19:10
@thomas11 thomas11 marked this pull request as ready for review January 24, 2024 08:40

@danielrbradley danielrbradley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Does your other PR have a note so we remember to remove this when it merges?

@thomas11

Copy link
Copy Markdown
Contributor Author

Looks good. Does your other PR have a note so we remember to remove this when it merges?

Added.

@thomas11 thomas11 merged commit 4b30867 into master Jan 24, 2024
@thomas11 thomas11 deleted the tkappler/DefenderForStorageSettings branch January 24, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DefenderForStorageSettings resource

2 participants