Finding "expired object delete markers" and removing them without using a lifecycle rule - amazon-s3

My company platform (Netapp) does not allow to define a Lifecycle rule to automatically delete expired objects delete markers ("ExpiredObjectDeleteMarker": true) in a versioned bucket.
What would be the best query to retrieve all these expired objects delete markers and delete them by myself ? So basically --query "objects having ONLY delete markers entries"
PS : I can do it in two rounds with --query 'DeleteMarkers[?IsLatest==true]' and then checking that the Versions collection is empty but it would be more efficient to filter directly in the query.

Related

How to get actual allowed values instead of reference to it with Attributes api in Rally

https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/<defect_id>/Attributes
After hitting the specified url we get the fields for the specified defect id but in order to fetch the allowed values for dropdown fields we have to hit another api.
Is there any other way through which we can get all the fields with the allowed values instead of the reference to the allowed values in a single api call?
Unfortunately with the introduction of WSAPI version 2.0, the ability to load sub collections of data within the initial request was removed. This was done in order to improve performance as it was previously possible to request too large a set of data and have a significant impact on the performance of the system.
So the only way to fetch the lists of allowed values for fields is to loop through the list of defect attributes, grab the necessary endpoint url from the _ref value and load it from there.
It could be worth saving the references to these attribute IDs as they shouldn't change as long as the fields aren't removed from the object model.

Is it possible to hard delete a Directus item through the API or app?

Deleting an item from a collection, which has a status field, through the UI or API results in the item being soft deleted. However, in this one particular instance, we want to remove it from the database entirely.
If not possible, can it safely be done through the database by just deleting it from the table carrying the name of the collection? Any side-effects when doing it this way?
Found the answer on this page https://v8.docs.directus.io/guides/status.html#soft-delete:
When deleting an item, the API does the following:
Check if the collection has a status field
Check if the delta data has the status field (meaning the status was changed)
Check if the new status value (from delta data) has soft_delete = true
If yes, it sets the action to SOFT_DELETE
If no, it hard deletes the item (permanently removed from the database)

How to handle delete booking webtours in jmeter?

How to handle the remove flight booking in webtours? It came to my mind that if I wanna run the test with 3 virtual users and how they supposed to delete the booking if the information down here (refer below) are unique for each virtual user? Does any of these variables below need to be parameterized or need to apply correlation?
If there are multiple flight id to be deleted, we can create a CSV file having those ids
and use a while loop controller to delete each of them.
You may refer -
https://guide.blazemeter.com/hc/en-us/articles/206733689-Using-CSV-DATA-SET-CONFIG
https://www.blazemeter.com/blog/using-while-controller-jmeter
As you said, it will differ for a different user, you can store each value from the response of each user(extract value using regex) and pass them in delete call.
reference link - https://guide.blazemeter.com/hc/en-us/articles/207421325-Using-RegEx-Regular-Expression-Extractor-with-JMeter-Using-RegEx-(Regular-Expression-Extractor)-with-JMeter
I don't know what "webtours" is, however there is one "golden" rule: each and every parameter which is dynamic needs to be correlated.
If you don't have any idea regarding which ones are dynamic - record the same action one more time using JMeter's HTTP(S) Test Script Recorder and compare the generated requests, parameter values (or even names) which differ needs to be correlated.
Another approach is to inspect the previous response(s) using View Results Tree listener and look if the data is present there
Check out Advanced Load Testing Scenarios with JMeter: Part 1 - Correlations article for more information and example implementation

How to delete conditions from Bigcommerce Product Rule

The Bigcommerce API documentation for Product Rules says the following in the Update a Product Rule section:
Updates an existing product rule. NOTE: if you include a conditions object array, its contents will be appended to any existing conditions. This operation does not overwrite existing conditions.
I need to delete existing conditions from a rule, but I can't figure out a way to do it. No matter what you pass in for conditions, it just gets appended to the conditions that are already there. You also can't clear out the conditions first, because the request is rejected if the conditions array is empty.
Is there any way to remove conditions from a rule besides recreating the entire rule?
First, BigCommerce is a little wonky.
I think your best bet is to simply go the manual route, with a 4 step process:
Ge the original rule and store it in a variable, via:
GET /stores/{store_hash}/v2/products/{product_id}/rules/{id}
Then Delete the original rule via:
DELETE /stores/{store_hash}/v2/products/{product_id}/rules/{id}
Now, edit the JSON response you store with the GET method to reflect the changes you want to make,
Finally, re-create the rule with your changes via:
POST /stores/{store_hash}/v2/products/{product_id}/rules/{id}
passing your edited JSON response as parameters.
Let me know if this helps and if you have nay other questions.

Optimal way to add / update EF entities if added items may or may not already exist

I need some guidance on adding / updating SQL records using EF. Lets say I am writing an application that stores info about files on a hard disk, into an EF4 database. When you press a button, it will scan all the files in a specified path (maybe the whole drive), and store information in the database like the file size, change date etc. Sometimes the file will already be recorded from a previous run, so its properties should be updated; sometimes a batch of files will be detected for the first time and will need to be added.
I am using EF4, and I am seeking the most efficient way of adding new file information and updating existing records. As I understand it, when I press the search button and files are detected, I will have to check for the presence of a file entity, retrieve its ID field, and use that to add or update related information; but if it does not exist already, I will need to create a tree that represents it and its related objects (eg. its folder path), and add that. I will also have to handle the merging of the folder path object as well.
It occurs to me that if there are many millions of files, as there might be on a server, loading the whole database into the context is not ideal or practical. So for every file, I might conceivably have to make a round trip to the database on disk to detect if the entry exists already, retrieve its ID if it exists, then another trip to update. Is there a more efficient way I can insert/update multiple file object trees in one trip to the DB? If there was an Entity context method like 'Insert If It Doesnt Exist And Update If It Does' for example, then I could wrap up multiple in a transaction?
I imagine this would be a fairly common requirement, how is it best done in EF? Any thoughts would be appreciated.(oh my DB is SQLITE if that makes a difference)
You can check if the record already exists in the DB. If not, create and add the record. You can then set the fields of the record which will be common to insert and update like the sample code below.
var strategy_property_in_db = _dbContext.ParameterValues().Where(r => r.Name == strategy_property.Name).FirstOrDefault();
if (strategy_property_in_db == null)
{
strategy_property_in_db = new ParameterValue() { Name = strategy_property.Name };
_dbContext.AddObject("ParameterValues", strategy_property_in_db);
}
strategy_property_in_db.Value = strategy_property.Value;