Unable to change min_decryption_version to 0 - hashicorp-vault

I have a requirement to create key in hashicorp, and change its min_decryption_version to 0. Key generation is successful, and the values are as below.
"latest_version": 2,
"min_available_version": 0,
"min_decryption_version": 1,
"min_encryption_version": 0,
I have tried to change min_decryption_version using transit/keys/mykey/config API. I am able to change the version to 2. When I change it to 0, the request is successful,but the values are not reflected in the key.
Is there any other pre-condition that needs to be satisfied before changing the min_decryption_version?

Related

How do reset groupFirstKey QueueConfiguration field to default value (null) via ActiveMQServerControl.updateQueue(String queueConfiguration)

I created a queue via the method ActiveMQServerControl.createQueue(String queueConfiguration) with a value for the groupFirstKey.
How to reset groupFirstKey field of QueueConfiguration this queue to default value (null) via ActiveMQServerControl.updateQueue(String queueConfiguration)?
If I set "" for groupFirstKey in the String queueConfiguration (for example {"name":"MAXC","address":"MAXC","routing-type":"ANYCAST","group-first-key":""}), then for the groupFirstKey value I get not null, but "", respectively.
Currently there is no way to do this via the management interface (i.e. using the ActiveMQServerControl) because ActiveMQServerControl.updateQueue(String queueConfiguration) ultimately performs a check on the members of the JSON input that is passed in, and any members that are null (i.e. don't exist) are not updated.
However, if you're using an embedded server then you can use the updateQueue(QueueConfiguration, boolean) method directly on org.apache.activemq.artemis.core.server.ActiveMQServer and pass true for the boolean to force any null parameters to be used for the update.

Not getting desired path with gtk_tree_view_get_path_at_pos ()

I have an application for which the user can open context menus inside a tree view. To get the current path after a right mouse click I use
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), event_button->x, event_button->y, &path, NULL, NULL, NULL), (event_button is of type GdkEventButton, which has been passed to the function)
which always reliably returns the correct path. I have ported my application to GTK4 now, where it is no longer possible to directly access the elements of an event. So I thought the way to go would be getting the coordinates by using
gdk_event_get_coords (event, &x_win, &y_win) (x_win and y_win are of type double)
and then
gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), (gint) x_win, (gint) y_win, &path, NULL, NULL, NULL).
However, with the coordinates received by gdk_event_get_coords I always end up with the following path inside the tree view (x_win delivers the value as expected). How can I retrieve the same values as in GTK3?
Using gtk_tree_view_convert_widget_to_bin_window_coords after gdk_event_get_coords does convert the original values to the expected results. The path is now the correct one.

Azure APIM Policy Editor

I would very much like to be able to set Azure API Policy attributes based on a User's Jwt Claims data. I have been able to set string values for things like the counter-key and increment-condition but I can't set all attributes. I imagined doing something like the following:
<rate-limit-by-key
calls="#((int) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/LimitRate/Limit", "5"))"
renewal-period="#((int) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/LimitRate/Duration/InSeconds", "60"))"
counter-key="#((string)context.Variables["Subject"])"
increment-condition="#(context.Response.StatusCode == 200)"
/>
However there seems to be some validation happening when I save the policy as I get the following error:
Error in element 'rate-limit-by-key' on line 98, column 10: The 'calls' attribute is invalid - The value '#((int) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/LimitRate/Limit", "5"))' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:int' - The string '#((int) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/LimitRate/Limit", "5"))' is not a valid Int32 value.
I even have trouble setting a string parameter (albeit one with a strict format)
<quota-by-key
calls="10"
bandwidth="100"
renewal-period="#((string) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/Quota/RenewalPeriod", "P00Y00M01DT00H00M00S"))"
counter-key="#((string)context.Variables["Subject"])"
/>
Which gives the following when I try and save the policy:
Error in element 'quota-by-key' on line 99, column 6: #((string) context.Variables["IdentityToken"].AsJwt().Claims.GetValueOrDefault("/Quota/RenewalPeriod", "P00Y00M01DT00H00M00S")) is not in a valid format. Provide number of seconds or use 'PxYxMxDTxHxMxS' format where 'x' is a number.
I have tried a large set of variations casting, Convert.ToInt32, claims that are not strings, #{return 5}, #(5) etc but there seems to be some validation happening at save time that is stopping it.
Is there away around this issue as I think it would be a useful feature to add to my API?
calls attribute on rate-limit-by-key and quota-by-key does not support policy expressions. Internal limitations block us from treating it on per-request basis unfortunately. The best you can do is categorize requests into a few finite groups and apply rate limit/quota conditionally using choose policy.
Or try using increment-count attribute to control by how much counter is increased per each request.

Set a variable in iReport/Jaspersoft Studio

I have a report using many variables to calculate a rolling inventory over 16 months. The users are requesting some difficult calculations in the rollover amount (or carryover) such as only carryover amounts > 0, but only for some categories(groups), and then add the carryover from one category to the carryover in another category. I have most of the issues worked out, but I need to set a variable for the carryover ONLY when the group ="XXX", and maintain that variable value even when the group changes. I can easily set the variable to change over categories (groups) $F{group1}=="XXX"?QTY_ON_HAND - QTY_ORDERED:0.0, but when the group changes to "YYY" and then to "ZZZ" the value of the variable changes to 0. I need to use the value of the variable when it is in the "XXX" group as part of the calculation when it gets to group "ZZZ", but if it resets to 0 at that time, it is useless. I have also tried setting the variable = $V{rollover_amount} and have tried that changing the Calculation Type, Reset Type, and Increment Types to no avail.
I have the Calculation set to "No Calculation", Increment and Reset types set to "None"
I am using Jaspersoft Studio 5.5, but the same would apply to iReport Designer.
I see two potential approaches.
1) It looks like you've already started by creating the calculation by using conditional logic in the Variable Expression property. Continue with this approach. Try resetting the variable to itself when the group condition fails. Something like:
$F{group1} == "XXX" ? {do what you need to do} : $F{group1}
2) Use a JasperReport Scriptlet and manage the logic outside the report.
http://jasperreports.sourceforge.net/sample.reference/scriptlet/

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.