cli icon indicating copy to clipboard operation
cli copied to clipboard

Add "sync" function for edge dictionary items

Open benzvan opened this issue 4 years ago • 2 comments

As a fastly configuration maintainer

When I change my local version of an edge dictionary

I want to easily synchronize adds, updates, and deletes with fastly

So that I don't leave cruft behind by forgetting to delete values

Notes: This is a larger enhancement but I'm hoping it's valuable to other users. We have a git repo where we maintain batch files for a few edge dictionaries and use the fastly CLI to push those batches up to our service. It would be great if my local copy of the dictionary, stored in json, could be synchronized with the remote copy via the CLI instead of manually maintaining batch files that have an expectation of the remote values.

benzvan avatar Sep 01 '21 15:09 benzvan

@benzvan in your current workflow, is this the command you are using? fastly dictionaryitem batchmodify --dictionary-id $dictionary_id --file dictionary_items.json

JakeChampion avatar Sep 02 '21 13:09 JakeChampion

Yep. That's the one. We're using op: upsert for basically all the items.

benzvan avatar Sep 02 '21 13:09 benzvan

I'm coming back to this today because we have an effort on our team to simplify the way we maintain our edge dictionaries. I'd love to see something like

fastly dictionary set --dictionary-id $dictionary_id --file dictionary_items.json

Where dictionary_items.json ==

{
  "dictionary_key1": "value1",
  "dictionary_key2": "value2",
  "dictionary_key3": "value3",
  "dictionary_key4": "value4"
}

and the result is the $dictionary_id matches the key/value pairs in the file when completed. If this was a built-in fastly API function, it would also simplify some of the terraform we use to copy k/v pairs into a dictionary.

benzvan avatar Nov 09 '22 16:11 benzvan