Adding a new default tier on API Manager - wso2-api-manager

I'm using API Manager 2.2.0
By default WSO2 API Manager comes with some Subscription Throttling Policies, such as Gold, Silver, and Bronze. I want to add a new one called Diamond.
I added this new tier using the Admin webpage (e.g. https://localhost:9443/admin) on all the existing tenants.
What I want to to now is to make this Diamond tier be generated by default when new tenants are created.
I edited the file default-tiers.xml adding the following code:
<wsp:Policy>
<throttle:ID throttle:type="ROLE">Diamond</throttle:ID>
<wsp:Policy>
<throttle:Control>
<wsp:Policy>
<throttle:MaximumCount>2000</throttle:MaximumCount>
<throttle:UnitTime>1000</throttle:UnitTime>
<wsp:Policy>
<throttle:Attributes>
<throttle:x-wso2-BillingPlan>FREE</throttle:x-wso2-BillingPlan>
<throttle:x-wso2-StopOnQuotaReach>true</throttle:x-wso2-StopOnQuotaReach>
</throttle:Attributes>
</wsp:Policy>
</wsp:Policy>
</throttle:Control>
</wsp:Policy>
</wsp:Policy>
When I create a new tenant and access the Admin webpage the tier isn't there. If I browse the resources on Carbon for that tenant I can see the file tiers.xml has the code above.
Since news tenants don't have it when I subscribe to an API using this Diamond tier it always returns 403 to me. If I use the other ones (e.g. Gold) everything work as expected.
How can I add a new tier to the list of default ones?
Any help is highly appreciated.

Since Tenants are isolated entities there is no OOTB way to achieve this. However, you can use a TenantMgtListener (implement onTenantCreate) [1] and call subscription add API[2].
[1] https://docs.wso2.com/display/Carbon4411/TenantMgtListener
[2] https://docs.wso2.com/display/AM260/apidocs/admin/#!/operations#SubscriptionPolicyCollection#throttlingPoliciesSubscriptionPost
p.s. default-tiers.xml nor tiers.xml is used in the new throttling implementation.

Related

Set country while scraping Amazon

I'm scraping prices from Amazon,Everything works fine except I'm facing an issue of location,apparently some products are not available outside of US so when my program runs it fails to fetch prices, I'm using Crawlera for US IP proxy, but it still fails for few requests.
Is there any way I can lock it US,using sending Cookies or Something like that.Any help or reference would be really helpful. Thanks in advance.
When you use Crawlera, you can create a new account through the web interface and set the region to US. Then replace your API key with the key for your newly created account.
See this guide for reference.

Azure Notification Hub device registration

Since AppCenter retiring at the end of this year, I have started migrating to Azure-Notification-Hub.
But the documentation for notification-hub is not clear at all. Especially the documentation for Xamarin.Android. It does not match with their latest SDK.
In the latest (version 1.1.1) azure-notification-hub SDK for Android (or Xamarin.Android) there's no need to implement FirebaseMessagingService. NotificationHub.Start() method registers the device in the Notification-Hub. A device registered with this way gets notifications without any problem.
NotificationHub.Start(Application, <HubName>, <ConnectionString>);
Addition tags to existing NotificationHub instance are also straightforward with the new SDK.
NotificationHub.AddTag("username:user123");
But in Registration Management official doc states that devices can register with the notification-hub either from client-side or from server-side. Is it necessary to use one of those methods if my app registered with the notification-hub using the NotificationHub.Start() method? Or do I missing something?
Also, when I was using the AppCenter, I have used the AppCenter-InstallId to target a specific device.
With that in mind is it possible to use the NotificationHub.InstallationId to use as a tag (eg: "handle:<devce's InstallationId>") to send device-specific notifications?
Is it necessary to use one of those methods if my app registered with the notification-hub using the NotificationHub.Start() method?
When you invoke NotificationHub.start(Application, ...), the Android SDK will listen for changes like added tags, new FirebaseMessagingService tokens, etc. Anytime it detects a change, it will invoke an InstallationAdapter to inform a backend of the new details.
The default InstallationAdapter will send an PUT request to the Azure Notification Hubs backend as documented here. This is what is created by NotificationHub.start(Application, string, string); for people who are not hosting their own backend, this is a sensible default.
If you have your own backend where you track devices, or you're just looking to keep your credentials server-side, you can swap out the InstallationAdapter to be a class that invokes your API. All you need to do is implement the InstallationAdapter interface and initialize the SDK by calling NotificationHub.start(Application, InstallationAdapter).
If you use the NotificationHub.start(...) methods as indicated above, there is no further registration action required.
With that in mind is it possible to use the NotificationHub.InstallationId to use as a tag (eg: "handle:<devce's InstallationId>") to send device-specific notifications?
Yes! This documentation walks you through how to use the special tag format $InstallationId:{YOUR_TAG_ID} to target a specific device.
When you've used NotificationHub.start(), if you do not specify an InstallationId, it will generate one for you.
Question about setting the InstallationId and/or UserId. If I'm using Microsoft.Azure.NotificationHubs.Client, which makes more sense to do.
Should I set the InstallationId via the $InstallationId Tag (see here: https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-registration-management#installations) or via implementing the InstallationEnrichmentAdapter and set it via a call to installation.InstallationId = in the EnrichInstallation method?
Additionally, the Microsoft.Azure.NotificationHubs.Client.Installation class provides a UserId property that can be updated too.
I'm also moving my push notifications from AppCenter to Azure Notification Hub and want to reuse my existing AppCenter InstallId.
i am able to add tags and userid as below(java)
NotificationHub.start(this.getApplication(), BuildConfig.hubName, BuildConfig.hubListenConnectionString);
NotificationHub.setInstallationId("123");
Set<String> tags = new HashSet<>();
tags.add("role_memeber");
NotificationHub.setUserId("123");
NotificationHub.addTags(tags);
sdk: com.microsoft.azure:notification-hubs-android-sdk:1.1.6

Corda Accounts - Ability to move an account to a different host node

In the Corda accounts library, in order to change the host "ownership" of the account from one node to another, one would need to change the Host in the AccountInfo state to the new host (node), along with share all vault states relevant to this account.
AccountInfo doesn't have an Update command (AccountInfo commands), meaning you cannot change the host once it is created.
Has this feature been excluded for any reason? Are there any plans to introduce an Update command (with supporting flows)?
What steps would be involved in a move/transfer (host ownership)? And what are the potential caveats around this implementation?
Amol there will be work done on this in the future but as of now, there are two options which could help you resolve your issue.
Set up a new account on the new node. Generate new key(s) for the new account. Spend all the states from the old account to this new account.
If you control the all the keys used to participate in your states and can migrate them to the new node then you just need to import the key pairs somehow and then copy all the states across from the old node to the new node.
Hope that helps.

getting this error even after putting different keys in facial recognition door sample

even after entering the key I have been subscribed to a standard plan of the face api service but getting this error constantly.! Tried changing the end points and creating s0 tier API to but getting same error .
The project is old, and does not allow for specifying the API endpoint. I've made a fix in a fork and a pull request to the main project. Cognitive Service API keys are valid in only one region (i.e. you cannot use a westeurope key in westus, etc.)

Marketing Cloud ID override

I'm using the Adobe Marketing Cloud ID Service (MCID) on an Adobe Analytics deployment.
Now I need to overwrite the native ID with a custom one and I'm thinking to exploit the s.visitorID variable.
As stated here: Visitors identification hierarchy , s.visitorID would be considered primarily to the default MID identification, but my question is:
Would the s.visitorID value used exactly like the default MID within the Marketing Cloud Suite (spread across solutions)?
I'm not sure if there is currently an offical way to override the MID.
Something to try though -
If you are using a first-party data collection server (the s_vi cookie is on a domain you own and writable from the app) you could try putting the MID value from the app directly into the s_vi cookie before MC code on the page runs (potentially in webview cookie store?)
MCID Service would then use that cookie value as a 'migrated' visitor ID during an MCID migration period.

Resources