void DrawTitleSection() { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); NSEditorStyles.DrawTitle(new GUIContent(" Hardlight Editor")); EditorGUILayout.EndVertical(); //NSEditorStyles.DrawLabel(" v" + NSManager.GetPluginVersionInfo().ToString()); NSEditorStyles.DrawButton("Plugin v" + NSManager.GetPluginVersionInfo().ToString()); if (NSEditorStyles.DrawButton(NSEditorStyles.CompactMode ? "Feedback" : "Send Feedback")) { Application.OpenURL(FeedbackLink); } if (NSEditorStyles.DrawButton(NSEditorStyles.CompactMode ? "Docs" : "Documentation")) { Application.OpenURL(DocumentationLink); } if (NSEditorStyles.DrawButton(NSEditorStyles.CompactMode ? "+" : "Compact Mode")) { NSEditorStyles.CompactMode = !NSEditorStyles.CompactMode; } EditorGUILayout.EndHorizontal(); //NSEditorStyles.DrawLabel("Holy Crap Dividers!"); //NSEditorStyles.DrawDivider(1); //NSEditorStyles.DrawLabel("In different styles!"); //NSEditorStyles.DrawDivider(3); //NSEditorStyles.DrawLabel("Sizes!"); //NSEditorStyles.DrawDivider(NSEditorStyles.ColorBoxType.Error, 8); //NSEditorStyles.DrawLabel("And colors!"); //NSEditorStyles.DrawDivider(NSEditorStyles.ColorBoxType.Black, 4); //NSEditorStyles.DrawDivider(NSEditorStyles.ColorBoxType.Tutorial, 8); }
public static void ListEventHubs() { LOG.InfoFormat("Listing ServiceBus Namespaces - SubscriptionId: {0}", SBClient.Credentials.SubscriptionId); var response = SBClient.Namespaces.List(); var i = 1; foreach (var ns in response.Namespaces) { LOG.InfoFormat("\r\nNamespace {0}:\r\n{1}", i++, ServiceBusNamespaceAsString(ns)); NSManager = NamespaceManager.CreateFromConnectionString(GetNamespaceConnectionString(ns.Name)); var eventHubs = NSManager.GetEventHubs(); var j = 1; foreach (var eh in eventHubs) { LOG.InfoFormat("\tEventHub {0}:\r\n\t{1}", j++, EventHubDescriptionAsString(eh)); } } }
public static void CreateIfNotExists() { EHRuleKey = SharedAccessAuthorizationRule.GenerateRandomKey(); EHDescription.Authorization.Add(new SharedAccessAuthorizationRule(EHRuleName, EHRuleKey, new AccessRights[] { AccessRights.Manage, AccessRights.Listen, AccessRights.Send })); try { LOG.InfoFormat("Checking Availability - ServiceBusNamespace: {0}, Region: {1}", SBNamespaceName, AppConfig.AzureResourceLocation); var availabilityResponse = SBClient.Namespaces.CheckAvailability(SBNamespaceName); LOG.InfoFormat("Checked Availability - ServiceBusNamespace: {0}, Available: {1}", SBNamespaceName, availabilityResponse.IsAvailable); if (!availabilityResponse.IsAvailable) { LOG.WarnFormat("Unavailable - ServiceBusNamespace: {0}", SBNamespaceName); LOG.InfoFormat("Checking existence of the namespace in current subscription - SubscriptionId: {0}, ServiceBusNamespace: {1}", AppConfig.SubscriptionId, SBNamespaceName); } else { var namespaceResponse = SBClient.Namespaces.Create(SBNamespaceName, AppConfig.AzureResourceLocation); SBNamespace = namespaceResponse.Namespace; LOG.InfoFormat("Created Namespace - ServiceBusNamespace: {0}, Region: {1}, Status: {2}", SBNamespace.Name, SBNamespace.Region, SBNamespace.Status); //Sleep a while to let namespace actually be active Thread.Sleep(60000); } } catch (Exception ex) { LOG.Error( String.Format("Unable to create ServiceBusNamespace - SubscriptionId: {0}, SBNamespaceName: {1}", AppConfig.SubscriptionId, SBNamespaceName), ex); throw; } LOG.InfoFormat("Getting Namespace Details - ServiceBusNamespace: {0}", SBNamespaceName); var namespaceConnectionString = GetNamespaceConnectionString(SBNamespaceName); LOG.InfoFormat("Found Namespace Details - ConnectionString: {0}", namespaceConnectionString); NSManager = NamespaceManager.CreateFromConnectionString(namespaceConnectionString); try { if (NSManager.EventHubExists(EHDescription.Path)) { EHDescription = NSManager.GetEventHub(EHDescription.Path); SharedAccessAuthorizationRule rule; EHDescription.Authorization.TryGetSharedAccessAuthorizationRule(EHRuleName, out rule); EHRuleKey = rule.PrimaryKey; } else { LOG.InfoFormat("Creating EventHub - Path: {0}, PartitionCount: {1}, MessageRetentionInDays: {2}", EHDescription.Path, EHDescription.PartitionCount, EHDescription.MessageRetentionInDays); Policy .Handle <Exception>() .WaitAndRetry( 3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(15, retryAttempt)), (exception, timeSpan, context) => { LOG.Warn(String.Format("Create failed, will retry - SubscriptionId: {0}, SBNamespaceName: {1}, EHPath: {2}", AppConfig.SubscriptionId, SBNamespaceName, EHDescription.Path), exception); } ) .Execute( () => { EHDescription = NSManager.CreateEventHubIfNotExists(EHDescription); } ); LOG.InfoFormat("Created EventHub - Path: {0}, Status: {1}", EHDescription.Path, EHDescription.Status); } LOG.InfoFormat("EventHub Details - Path: {0}, SAS Name: {1}, SAS Key: {2}", EHDescription.Path, EHRuleName, EHRuleKey); } catch (Exception ex) { LOG.Error(String.Format("Failed to create EventHub - SubscriptionId: {0}, SBNamespaceName: {1}. EventHubName: {2}", AppConfig.SubscriptionId, SBNamespaceName, EHDescription.Path), ex); throw; } }