public IEnumerable<StorageServicePropertiesOperationContext> GetStorageServicesProcess()
		{
			IEnumerable<StorageServicePropertiesOperationContext> storageServicePropertiesOperationContexts;
			Func<string, StorageServiceList> func = null;
			Func<StorageServicePropertiesOperationContext, bool> func1 = null;
			IEnumerable<StorageServicePropertiesOperationContext> storageServicePropertiesOperationContexts1 = null;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					Func<StorageService, StorageServicePropertiesOperationContext> func2 = null;
					Func<StorageService, StorageServicePropertiesOperationContext> func3 = null;
					GetAzureStorageAccountCommand getAzureStorageAccountCommand = this;
					if (func == null)
					{
						func = (string s) => base.Channel.ListStorageServices(s);
					}
					StorageServiceList storageServiceList = ((CmdletBase<IServiceManagement>)getAzureStorageAccountCommand).RetryCall<StorageServiceList>(func);
					Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
					if (storageServiceList != null)
					{
						if (!string.IsNullOrEmpty(this.StorageAccountName))
						{
							StorageServiceList storageServiceList1 = storageServiceList;
							if (func3 == null)
							{
								func3 = (StorageService service) => {
									string empty;
									StorageServicePropertiesOperationContext storageServicePropertiesOperationContext = new StorageServicePropertiesOperationContext();
									storageServicePropertiesOperationContext.StorageAccountName = service.ServiceName;
									storageServicePropertiesOperationContext.set_OperationId(this.operation.OperationTrackingId);
									storageServicePropertiesOperationContext.set_OperationDescription(this.CommandRuntime.ToString());
									storageServicePropertiesOperationContext.set_OperationStatus(this.operation.Status);
									storageServicePropertiesOperationContext.AffinityGroup = service.StorageServiceProperties.AffinityGroup;
									storageServicePropertiesOperationContext.StorageAccountDescription = service.StorageServiceProperties.Description;
									StorageServicePropertiesOperationContext storageServicePropertiesOperationContext1 = storageServicePropertiesOperationContext;
									if (service.StorageServiceProperties.Label != null)
									{
										empty = ServiceManagementHelper.DecodeFromBase64String(service.StorageServiceProperties.Label);
									}
									else
									{
										empty = string.Empty;
									}
									storageServicePropertiesOperationContext1.Label = empty;
									storageServicePropertiesOperationContext.Location = service.StorageServiceProperties.Location;
									storageServicePropertiesOperationContext.Endpoints = service.StorageServiceProperties.Endpoints;
									storageServicePropertiesOperationContext.StorageAccountStatus = service.StorageServiceProperties.Status;
									storageServicePropertiesOperationContext.GeoReplicationEnabled = service.StorageServiceProperties.GeoReplicationEnabled;
									storageServicePropertiesOperationContext.GeoPrimaryLocation = service.StorageServiceProperties.GeoPrimaryRegion;
									storageServicePropertiesOperationContext.GeoSecondaryLocation = service.StorageServiceProperties.StatusOfSecondary;
									storageServicePropertiesOperationContext.StatusOfPrimary = service.StorageServiceProperties.StatusOfPrimary;
									storageServicePropertiesOperationContext.StatusOfSecondary = service.StorageServiceProperties.StatusOfSecondary;
									return storageServicePropertiesOperationContext;
								}
								;
							}
							IEnumerable<StorageServicePropertiesOperationContext> storageServicePropertiesOperationContexts2 = storageServiceList1.Select<StorageService, StorageServicePropertiesOperationContext>(func3);
							if (func1 == null)
							{
								func1 = (StorageServicePropertiesOperationContext s) => s.StorageAccountName.Equals(this.StorageAccountName, StringComparison.InvariantCultureIgnoreCase);
							}
							storageServicePropertiesOperationContexts1 = storageServicePropertiesOperationContexts2.Where<StorageServicePropertiesOperationContext>(func1);
						}
						else
						{
							StorageServiceList storageServiceList2 = storageServiceList;
							if (func2 == null)
							{
								func2 = (StorageService service) => {
									string empty;
									StorageServicePropertiesOperationContext storageServicePropertiesOperationContext = new StorageServicePropertiesOperationContext();
									storageServicePropertiesOperationContext.StorageAccountName = service.ServiceName;
									storageServicePropertiesOperationContext.OperationId = operation.OperationTrackingId;
									storageServicePropertiesOperationContext.OperationDescription = this.CommandRuntime.ToString();
									storageServicePropertiesOperationContext.OperationStatus = operation.Status;
									storageServicePropertiesOperationContext.AffinityGroup = service.StorageServiceProperties.AffinityGroup;
									storageServicePropertiesOperationContext.StorageAccountDescription = service.StorageServiceProperties.Description;
									StorageServicePropertiesOperationContext storageServicePropertiesOperationContext1 = storageServicePropertiesOperationContext;
									if (service.StorageServiceProperties.Label != null)
									{
										empty = ServiceManagementHelper.DecodeFromBase64String(service.StorageServiceProperties.Label);
									}
									else
									{
										empty = string.Empty;
									}
									storageServicePropertiesOperationContext1.Label = empty;
									storageServicePropertiesOperationContext.Location = service.StorageServiceProperties.Location;
									storageServicePropertiesOperationContext.Endpoints = service.StorageServiceProperties.Endpoints;
									storageServicePropertiesOperationContext.StorageAccountStatus = service.StorageServiceProperties.Status;
									storageServicePropertiesOperationContext.GeoReplicationEnabled = service.StorageServiceProperties.GeoReplicationEnabled;
									storageServicePropertiesOperationContext.GeoPrimaryLocation = service.StorageServiceProperties.GeoPrimaryRegion;
									storageServicePropertiesOperationContext.GeoSecondaryLocation = service.StorageServiceProperties.StatusOfSecondary;
									storageServicePropertiesOperationContext.StatusOfPrimary = service.StorageServiceProperties.StatusOfPrimary;
									storageServicePropertiesOperationContext.StatusOfSecondary = service.StorageServiceProperties.StatusOfSecondary;
									return storageServicePropertiesOperationContext;
								}
								;
							}
							storageServicePropertiesOperationContexts1 = storageServiceList2.Select<StorageService, StorageServicePropertiesOperationContext>(func2);
						}
					}
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					if (communicationException as EndpointNotFoundException == null || base.IsVerbose())
					{
						this.WriteErrorDetails(communicationException);
					}
					else
					{
						storageServicePropertiesOperationContexts = null;
						return storageServicePropertiesOperationContexts;
					}
				}
				return storageServicePropertiesOperationContexts1;
			}
			return storageServicePropertiesOperationContexts;
		}
Пример #2
0
        private bool StorageAccountVerify(StorageServicePropertiesOperationContext storageContext,
            string [] staticParameters, string label, string description, bool geo)
        {
            string name = staticParameters[0];
            string location = staticParameters[1];
            string affinity = staticParameters[2];

            Console.WriteLine("Name: {0}, Label: {1}, Description: {2}, AffinityGroup: {3}, Location: {4}, GeoReplicationEnabled: {5}",
                storageContext.StorageAccountName,
                storageContext.Label,
                storageContext.StorageAccountDescription,
                storageContext.AffinityGroup,
                storageContext.Location,
                storageContext.GeoReplicationEnabled);

            try
            {
                Assert.AreEqual(storageContext.StorageAccountName, name, "Error: Storage Account Name is not equal!");
                Assert.AreEqual(storageContext.Label, label, "Error: Storage Account Label is not equal!");
                Assert.AreEqual(storageContext.StorageAccountDescription, description, "Error: Storage Account Description is not equal!");
                Assert.AreEqual(storageContext.AffinityGroup, affinity, "Error: Affinity Group is not equal!");
                Assert.AreEqual(storageContext.Location, location, "Error: Location is not equal!");
                Assert.AreEqual(storageContext.GeoReplicationEnabled, geo, "Error: GeoReplicationEnabled is not equal!");
                Console.WriteLine("All contexts are matched!!\n");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return false;
            }
            return true;
        }