public static GlobalComponents Create(string azurePath, string subscriptionsDataFile, X509Certificate2 certificate, string serviceEndpoint) { Validate.ValidateNullArgument(azurePath, string.Format(Resources.InvalidNullArgument, "azurePath")); Validate.ValidateNullArgument(certificate, string.Format(Resources.InvalidCertificateSingle, "certificate")); Validate.ValidateNullArgument(serviceEndpoint, string.Format(Resources.InvalidEndpoint, "serviceEndpoint")); var globalComponents = new GlobalComponents(azurePath, subscriptionsDataFile); globalComponents.New(globalComponents.GlobalPaths.SubscriptionsDataFile, certificate, serviceEndpoint); globalComponents.Save(); return globalComponents; }
public static void SetCurrentSubscription(this PSCmdlet cmdlet, string subscriptionName, string subscriptionDataFile) { if (subscriptionName == null) { throw new ArgumentNullException("subscriptionName", Resources.InvalidSubscriptionName); } var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory, subscriptionDataFile); SubscriptionData subscriptionData; if (!globalComponents.Subscriptions.TryGetValue(subscriptionName, out subscriptionData)) { throw new ArgumentException(string.Format( CultureInfo.InvariantCulture, Resources.InvalidSubscription, subscriptionName)); } SetCurrentSubscription(cmdlet, subscriptionData); }
public static GlobalComponents CreateFromPublishSettings(string azurePath, string subscriptionsDataFile, string publishSettingsFile) { Validate.ValidateNullArgument(azurePath, string.Format(Resources.InvalidNullArgument, "azurePath")); var globalComponents = new GlobalComponents(azurePath, subscriptionsDataFile); globalComponents.NewFromPublishSettings(globalComponents.GlobalPaths.SubscriptionsDataFile, publishSettingsFile); globalComponents.Save(); return globalComponents; }
public static GlobalComponents Load(string azurePath, string subscriptionsDataFile) { Validate.ValidateNullArgument(azurePath, string.Format(Resources.InvalidNullArgument, "azurePath")); Validate.ValidateStringIsNullOrEmpty(azurePath, Resources.AzureDirectoryName); var globalComponents = new GlobalComponents(azurePath, subscriptionsDataFile); globalComponents.LoadCurrent(); return globalComponents; }
public static void AreEqualGlobalComponents(GlobalPathInfo paths, PublishData publishSettings, GlobalComponents actual) { AreEqualGlobalPathInfo(paths, actual.GlobalPaths); }
public static void AreEqualGlobalComponents(GlobalComponents expected, GlobalComponents actual) { AreEqualGlobalComponents(expected.GlobalPaths, expected.PublishSettings, actual); }
public static IDictionary <string, SubscriptionData> GetSubscriptions(this PSCmdlet cmdlet, string subscriptionDataFile) { return(GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory, subscriptionDataFile).Subscriptions); }