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

Atomic Mutations #15

Closed
jafaircl opened this issue Mar 7, 2019 · 2 comments
Closed

Atomic Mutations #15

jafaircl opened this issue Mar 7, 2019 · 2 comments
Labels
discussion 🗣️ Something needs discussion work in progress 🔧 Further work to be done before being included in the library

Comments

@jafaircl
Copy link
Contributor

jafaircl commented Mar 7, 2019

The REST API has a way to create multiple objects atomically in a single request by using temporary IDs. That way, if one of the requests fails, they all fail and you won't have to go back and delete the ones that worked to maintain consistency. One example is creating campaign budgets and campaigns at the same time. The request would look something like this:

// POST /v1/customer/123456789/googleAds:mutate

mutate_operations: [
  {
    campaign_budget_operation: {
      create: { name: "test budget", resource_name: "customers/123456789/campaignBudgets/-1" }
    },
    campaign_operation: {
      create: { name: "test campaign", campaign_budget: "customers/123456789/campaignBudgets/-1", resource_name: "customers/123456789/campaigns/-2" }
    }
  },
  ...etc
]

I don't know that there's a way to handle such a request in gRPC. But, it might not be a terrible idea to expose a mutate method that allows raw mutations such as this that otherwise wouldn't be possible. Would you be open to having such a method in the new API?

@kritzware
Copy link
Contributor

Hi @jafaircl,

I'm going to do some tests and see if this is possible with gRPC. On the API method, this is definitely something we might consider (depending on the possibilities with gRPC).

@kritzware kritzware added the discussion 🗣️ Something needs discussion label Mar 8, 2019
@kritzware kritzware added the work in progress 🔧 Further work to be done before being included in the library label Apr 17, 2019
@avermeil
Copy link
Member

Merged in -- will release a new minor version shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion 🗣️ Something needs discussion work in progress 🔧 Further work to be done before being included in the library
Projects
None yet
Development

No branches or pull requests

3 participants