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

Azure - CosmosDB Replace Offer Action #4332

Merged
merged 7 commits into from Jul 5, 2019

Conversation

axis7818
Copy link
Collaborator

@axis7818 axis7818 commented Jul 5, 2019

Support for ReplaceOffer on CosmosDB Collections

Addresses #4311

  • Created CosmosDBReplaceOfferAction and refactored shared code with CosmosDBOfferFilter
    • This action does not operate on individual resources since the offer lives on the account. So, the _process_resource is ignored and _process_resources is overridden instead.
  • CosmosDBChildResource.get_cosmos_key was modified to get read & write keys instead of read only keys.

Example Policy

Limit offer throughput to 400 RU/s

policies:
  - name: replace-offer-action
    resource: azure.cosmosdb-collection
    filters:
      - type: offer
        key: content.offerThroughput
        op: gt
        value: 400
    actions:
      - type: replace-offer
        throughput: 400

Copy link
Collaborator

@stefangordon stefangordon left a comment

Choose a reason for hiding this comment

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

I like the refactor.

'replace-offer',
required=['throughput'],
**{
'throughput': {'type': 'number'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want you can enforce >0 (and even maximum, if there is one) here. 'throughput': {'type': 'number', 'minimum': 0}

@stefangordon stefangordon merged commit 04c2902 into cloud-custodian:master Jul 5, 2019
@stefangordon stefangordon added this to the Azure Milestone A milestone Jul 23, 2019
fidelito pushed a commit to fidelito/cloud-custodian that referenced this pull request May 29, 2020
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.

None yet

2 participants