I am trying to index some data to search service and retrieve it using search queries which is in Government cloud. The search service Url ends with (.search.azure.us). This is different from normal azure search service where URL ends up with (.search.windows.net).
Our team uses Azure .Net SDK version 5 and I see that when I create SearchIndexClient with a service name the constructor validates the service url and always appends .search.windows.net at the end of it and will fail for gcc urls like *.search.azure.us.
I Was looking into the Azure search client library and SearchIndexClient always validates with .search.wndows.net suffix
private static void ValidateSearchServiceAndIndexNames(string searchServiceName, string indexName)
{
Throw.IfNullOrEmptySearchServiceName(searchServiceName);
SearchIndexClient.ThrowIfNullOrEmptyIndexName(indexName, nameof (indexName));
if (TypeConversion.TryParseUri(string.Format("https://{0}.search.windows.net/indexes('{1}')/",
(object) searchServiceName, (object) indexName)) == (Uri) null)
throw new ArgumentException(string.Format("Either the search service name '{0}' or the index name
'{1}' is invalid. Names must contain only characters that are valid in a URL.", (object)
searchServiceName, (object) indexName), nameof (searchServiceName));
}
So is there any upgraded version of sdk available where search index client could support URLs like ".search.azure.us"? or any other recommended way for government cloud urls?
Is it as simple as setting SearchDnsSuffix Property correctly on searchIndexClient to the appropriate suffix?
Could you share how you are instantiating your SearchIndexClient? My hunch is that you've included the domain suffix in your search service or index name, which would trigger the error that you're seeing. Try setting SearchDnsSuffix to "search.azure.us".
Reference docs:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.search.searchindexclient.searchdnssuffix?view=azure-dotnet#Microsoft_Azure_Search_SearchIndexClient_SearchDnsSuffix
Related
I used to be able to retrieve the search URL from Microsoft.Azure.Search.Models.SearchParameters by calling ToString() on an object of that type. This seems to have broken, now ToString() just returns the class name (default .net behavior).
Is there an alternate way to get the search URL from SearchParameters.
I'm on Azure search 9.0.1.
The behavior that I'm expecting was documented in a previous version here: https://learn.microsoft.com/en-us/previous-versions/azure/dn957315(v%3dazure.100)
The use case for this is that I have a search UI built on top of the azure search SDK - take a look here https://www.music4dance.net/song/advancedsearchform. The UI runs on top of an Asp.Net MVC infrastructure that uses Azure Search as the engine to produce results.
When diagnosing issues or looking into ways to extend this UI, I used to be able to run a search and see both the results and generate a URL (using the aforementioned ToString()). The search URL made it easy to plug back into the Search Explorer in the Azure Portal and tweak things until I get what I want before going back to code to make it generate the right query.
If you would like this behavior back, please create a github issue: https://github.com/Azure/azure-sdk-for-net/issues
For now you can implement it by yourself using the old code as guide: https://github.com/Azure/azure-sdk-for-net/blob/e63db195f2f2213984d4bdf81e7c495527b6217d/src/SDKs/Search/DataPlane/Microsoft.Azure.Search.Data/Customizations/Documents/Models/SearchParameters.cs#L157
I wrote my first Gmail API program in C# starting with the help I found
at:
https://developers.google.com/gmail/api/quickstart/dotnet
The problem is the name of the app, according to Google, listed under "Third-party apps with account access", is "Quickstart", which is not a very descriptive name for my app. Am I stuck with that name?
I've tried to search the source files for "Quickstart" and can't find out where the name is coming from. I've made sure to specify my preferred name in the ApplicationName parameter of the service connect.
// Create Gmail API service.
var service = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "EMailChecker",
});
But that makes no difference. I've tried removing access via my Google account and re-running the program to let it authenticate, but that does not affect. It still shows up as "Quickstart".
So am I stuck with that name? Other than that, the program is working well.
It is also stated in the documentation that if you are modifying these scopes, delete your previously saved credentials at ~/.credentials/gmail-dotnet-quickstart.json.
You may check this link for reference: Where is ~/.credentials/drive-python-quickstart.json saved for Google Drive API Python Implementation?
In OSB Layer when the endpoint uri is changed, I need to alert the core group that the endpoint has changed and to review it. I tried SLA Alert rules but it does not have options for it. My question is, the endpoint uri should be saved somewhere in the underlying database. If so what is the schema and the table name to query it.
URI or in fact any other part of OSB artifact is not stored in relational database but rather kept in memory in it's original XML structure. It can be only accessed thru dedicated session management API. Interfaces you will need to use are part o com.bea.wli.sb.management.configuration and com.bea.wli.sb.management.query packages. Unfortunately it is not as straightforward as it sounds, in short, to extract URI information you will need to:
Create session instance(SessionManagementMBean)
Obtain ALSBConfigurationMBean instance that operates on SessionManagementMBean
Create Query object instance(BusinessServiceQuery) an run it on ALSBConfigurationMBean to get ref object to osb artifact of your interest
Invoke getServiceDefinition on your ref object to get XML service
definition
Extract URI from XML service definition with XPath
Downside of this approach is that you are basically pooling configuration each time you want to check if anything has changed.
More information including JAVA/WLST examples can be found in Oracle Fusion Middleware Java API Reference for Oracle Service Bus
There is also a good blog post describing OSB customization with WLST ALSB/OSB customization using WLST
The information about services and all its properties can be obtained via Java API. The API documentation contains sample code, so you can get it up and running quite quickly, see the Querying resources paragraph when following the given link.
We use the API to read the service (both proxy and business) configuration and for simple management.
As long as you only read the properties you do not need to handle management sessions. Once you change the values, you need to start a session and activate it once you are done -- a very similar approach to Service bus console.
The Problem
The SharePoint adapter for Breeze expects a model with a SharePoint list name and then attempts by default to access _api/web/lists/getbytitle('<DefaultResourceName>') and I have not found a way to over ride that. The problem with this behavior is that if a user who is not a site collection admin accesses the User Information List using the web/lists/ end point they will receive a 404 error. Instead, for whatever reason, regular users must access the same exact information via _api/Web/SiteUserInfoList/items.
The Question
What would be the best way to add functionality to the Breeze SharePoint adapter to get user details or a list of site users? In my existing solution I have merely changed my data context object to use $http and the _api/Web/SiteUserInfoList/itemsend point but I'd like to still be able to use Breeze's amazing filtering ability but it's not clear to me the best path to begin adding this functionality to the adapter.
With breeze you can configure specific AJAX requests using a request interceptor.
The example below changes the timeout but you could just as easily change the url.
var ajaxAdapter = breeze.config.getAdapterInstance('ajax');
ajaxAdapter.requestInterceptor = function (requestInfo) {
requestInfo.config.timeout = 5000;
// todo: examine the requestInfo.config object and change the url as-needed
}
here's the relevant code in the breeze source
I want to make database queries in my Jersey REST webapp. The ideal situation would be to find a way where the database connection is initialised once at the first app run. Afterwards I only get the instance of DAOFactory object in my REST class and make the queries in the methods. I am using mysql connector. Is there a way to find a way to do it in Jersey? In JSF it was possible - I just used an application-scoped bean when I run the code. Moreover it would be good if I could access the ServletContext object inside this method cause I would like to use it's getResourceAsStream() method to read the database connection parameters from WEB-INF/dao.properties file. But the 'only once per app initialisation' is the crucial part here.