Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ProtectionMode to Microsoft.Security applicationWhitelistings #7243

Merged
merged 8 commits into from
Sep 24, 2019
Merged

Add ProtectionMode to Microsoft.Security applicationWhitelistings #7243

merged 8 commits into from
Sep 24, 2019

Conversation

erelh
Copy link
Contributor

@erelh erelh commented Sep 18, 2019

Latest improvements:

MSFT employees can try out our new experience at OpenAPI Hub - one location for using our validation tools and finding your workflow.

Contribution checklist:

  • I have reviewed the documentation for the workflow.
  • Validation tools were run on swagger spec(s) and have all been fixed in this PR.
  • The OpenAPI Hub was used for checking validation status and next steps.

ARM API Review Checklist

  • Service team MUST add the "WaitForARMFeedback" label if the management plane API changes fall into one of the below categories.
  • adding/removing APIs.
  • adding/removing properties.
  • adding/removing API-version.
  • adding a new service in Azure.

Failure to comply may result in delays for manifest application. Note this does not apply to data plane APIs.

  • If you are blocked on ARM review and want to get the PR merged urgently, please get the ARM oncall for reviews (RP Manifest Approvers team under Azure Resource Manager service) from IcM and reach out to them.
    Please follow the link to find more details on API review process.

@openapi-sdkautomation
Copy link

openapi-sdkautomation bot commented Sep 18, 2019

In Testing, Please Ignore

[Logs] (Generated from 16c7d5f, Iteration 10)

Failed .NET: test-repo-billy/azure-sdk-for-net [Logs] [Diff]
In-Progress Go: test-repo-billy/azure-sdk-for-go [Logs] [Diff]
  • In-Progress preview/security/mgmt/v1.0 [Logs]
  • In-Progress preview/security/mgmt/v2.0 [Logs]
  • In-Progress preview/security/mgmt/v3.0 [Logs]
Succeeded Python: test-repo-billy/azure-sdk-for-python [Logs] [Diff]
Failed JavaScript: test-repo-billy/azure-sdk-for-js [Logs] [Diff]

@AutorestCI
Copy link

AutorestCI commented Sep 18, 2019

Automation for azure-sdk-for-python

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-python#7377

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@AutorestCI
Copy link

AutorestCI commented Sep 18, 2019

Automation for azure-sdk-for-go

A PR has been created for you based on this PR content.

Once this PR will be merged, content will be added to your service PR:
Azure/azure-sdk-for-go#5863

"additionalProperties": {
"type": "string"
}
},
Copy link
Member

Choose a reason for hiding this comment

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

This seems to represent a mapping from file type (enum) to protection mode which seems like an enum also. Generally, using additionalProperties is discouraged because it makes APIs harder to use. In you case, you could model each file type as an optional property in this object and let the value be a protection mode enum type. This option would preserve the current shape of the object over the wire.

Another option would be to model this as an array of objects with 2 properties: file type and protection mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@majastrz , Done

Copy link
Member

Choose a reason for hiding this comment

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

There are few potential new ARM errors, property names should be camel case. See this report https://dev.azure.com/azure-sdk/public/_build/results?buildId=114422&view=logs

@majastrz majastrz added the ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review label Sep 19, 2019
Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

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

Added a comment. Please take a look.

@majastrz majastrz added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels Sep 20, 2019
Copy link
Member

@majastrz majastrz left a comment

Choose a reason for hiding this comment

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

Signed off from ARM side.

@erelh
Copy link
Contributor Author

erelh commented Sep 20, 2019

@anuchandy can you please complete the merge ?

Copy link
Member

@anuchandy anuchandy left a comment

Choose a reason for hiding this comment

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

Please review linter errors related to not using camelcase for property names

@erelh
Copy link
Contributor Author

erelh commented Sep 20, 2019

i cant make the properties camelCase because they are a defined Enum

@anuchandy
Copy link
Member

@erelh The json "property names/keys" over the wire is suppose to follow camelCase. In the server code, it can be camelCase, PasalCase or any format but over wire it is suppose to be in camelCase. For example:

This is valid (address.state)

{
   address: {
     state: 'WA'
  }
}

But below one not, because state in address.State is a property key and should be camel case.

{
   address: {
     State: 'wa'
  }
}

This is based on ARM rule 3016. Adding @majastrz to comment.

@majastrz
Copy link
Member

While the property names are logically values of the enum, you can still make them lowerCaseCamelCase. In the backend, you can have case-insensitive parsing, so it shouldn't really be a problem.

@erelh
Copy link
Contributor Author

erelh commented Sep 20, 2019

in C#, Enum parsing is case sensitive
since this object is defined as a key-value of Enum to Enum, it has to be uppercase

can you please suggest a different method of defining this property ? as it is a key-value

@majastrz
Copy link
Member

in C#, Enum parsing is case sensitive
since this object is defined as a key-value of Enum to Enum, it has to be uppercase

can you please suggest a different method of defining this property ? as it is a key-value

In general, there is some control in C# over enum parsing. Unfortunately, that's not possible if you're deserializing as Dictionary<enum1,enum2> unless you customize deserializer settings.

Regardless of that, the API should be designed up-front and the service should then be implemented ot match - not the other way as you're trying here.

ARM is expecting property names to be case insensitive for the most part, so if we made your API case-sensitive, it will be inconsistent. You should change the service to be case-insensitive. One way to do this would be to get rid of the dictionary since you have a small set of properties and simply model it as 4 properties: exe, msi, executable, and script. If something else requires a dictionary then you can easily convert it.

@erelh
Copy link
Contributor Author

erelh commented Sep 24, 2019

OK, changed
Please complete the PR
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants