Ejemplo n.º 1
0
        private CimSessionProxy CreateSessionProxy(CimSession session, GetCimAssociatedInstanceCommand cmdlet)
        {
            CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(session);

            this.SetSessionProxyProperties(ref cimSessionProxy, cmdlet);
            return(cimSessionProxy);
        }
        /// <summary>
        /// Create <see cref="CimSessionProxy"/> and set properties.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private CimSessionProxy CreateSessionProxy(
            CimSession session,
            GetCimAssociatedInstanceCommand cmdlet)
        {
            CimSessionProxy proxy = CreateCimSessionProxy(session);

            SetSessionProxyProperties(ref proxy, cmdlet);
            return(proxy);
        }
Ejemplo n.º 3
0
 private void SetSessionProxyProperties(ref CimSessionProxy proxy, GetCimAssociatedInstanceCommand cmdlet)
 {
     proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
     proxy.KeyOnly          = cmdlet.KeyOnly;
     if (cmdlet.ResourceUri != null)
     {
         proxy.ResourceUri = cmdlet.ResourceUri;
     }
 }
Ejemplo n.º 4
0
		private void SetSessionProxyProperties(ref CimSessionProxy proxy, GetCimAssociatedInstanceCommand cmdlet)
		{
			proxy.OperationTimeout = cmdlet.OperationTimeoutSec;
			proxy.KeyOnly = cmdlet.KeyOnly;
			if (cmdlet.ResourceUri != null)
			{
				proxy.ResourceUri = cmdlet.ResourceUri;
			}
		}
        /// <summary>
        /// <para>
        /// Create <see cref="CimSessionProxy"/> and set properties
        /// </para>
        /// </summary>
        /// <param name="computerName"></param>
        /// <param name="cimInstance"></param>
        /// <param name="cmdlet"></param>
        /// <returns></returns>
        private CimSessionProxy CreateSessionProxy(
            string computerName,
            CimInstance cimInstance,
            GetCimAssociatedInstanceCommand cmdlet)
        {
            CimSessionProxy proxy = CreateCimSessionProxy(computerName, cimInstance);

            SetSessionProxyProperties(ref proxy, cmdlet);
            return(proxy);
        }
Ejemplo n.º 6
0
        public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet)
        {
            IEnumerable <string> computerNames = ConstValue.GetComputerNames(cmdlet.ComputerName);
            string @namespace = cmdlet.Namespace;

            if (@namespace == null && cmdlet.ResourceUri == null)
            {
                @namespace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
            }
            List <CimSessionProxy> cimSessionProxies = new List <CimSessionProxy>();
            string parameterSetName = cmdlet.ParameterSetName;
            string str = parameterSetName;

            if (parameterSetName == null)
            {
                return;
            }
            else
            {
                if (str == "ComputerSet")
                {
                    foreach (string computerName in computerNames)
                    {
                        CimSessionProxy cimSessionProxy = this.CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
                        cimSessionProxies.Add(cimSessionProxy);
                    }
                }
                else
                {
                    if (str == "SessionSet")
                    {
                        CimSession[] cimSession = cmdlet.CimSession;
                        for (int i = 0; i < (int)cimSession.Length; i++)
                        {
                            CimSession      cimSession1      = cimSession[i];
                            CimSessionProxy cimSessionProxy1 = this.CreateSessionProxy(cimSession1, cmdlet);
                            cimSessionProxies.Add(cimSessionProxy1);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                foreach (CimSessionProxy cimSessionProxy2 in cimSessionProxies)
                {
                    cimSessionProxy2.EnumerateAssociatedInstancesAsync(@namespace, cmdlet.CimInstance, cmdlet.Association, cmdlet.ResultClassName, null, null);
                }
                return;
            }
        }
        /// <summary>
        /// <para>
        /// Base on parametersetName to retrieve associated ciminstances
        /// </para>
        /// </summary>
        /// <param name="cmdlet"><see cref="GetCimInstanceCommand"/> object.</param>
        public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet)
        {
            IEnumerable <string> computerNames = ConstValue.GetComputerNames(cmdlet.ComputerName);
            // use the namespace from parameter
            string nameSpace = cmdlet.Namespace;

            if ((nameSpace == null) && (cmdlet.ResourceUri == null))
            {
                // try to use namespace of ciminstance, then fall back to default namespace
                nameSpace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
            }

            List <CimSessionProxy> proxys = new List <CimSessionProxy>();

            switch (cmdlet.ParameterSetName)
            {
            case CimBaseCommand.ComputerSetName:
                foreach (string computerName in computerNames)
                {
                    CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
                    proxys.Add(proxy);
                }

                break;

            case CimBaseCommand.SessionSetName:
                foreach (CimSession session in cmdlet.CimSession)
                {
                    CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
                    proxys.Add(proxy);
                }

                break;

            default:
                return;
            }

            foreach (CimSessionProxy proxy in proxys)
            {
                proxy.EnumerateAssociatedInstancesAsync(
                    nameSpace,
                    cmdlet.CimInstance,
                    cmdlet.Association,
                    cmdlet.ResultClassName,
                    null,
                    null);
            }
        }
Ejemplo n.º 8
0
		public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet)
		{
			IEnumerable<string> computerNames = ConstValue.GetComputerNames(cmdlet.ComputerName);
			string @namespace = cmdlet.Namespace;
			if (@namespace == null && cmdlet.ResourceUri == null)
			{
				@namespace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
			}
			List<CimSessionProxy> cimSessionProxies = new List<CimSessionProxy>();
			string parameterSetName = cmdlet.ParameterSetName;
			string str = parameterSetName;
			if (parameterSetName == null)
			{
				return;
			}
			else
			{
				if (str == "ComputerSet")
				{
					foreach (string computerName in computerNames)
					{
						CimSessionProxy cimSessionProxy = this.CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
						cimSessionProxies.Add(cimSessionProxy);
					}
				}
				else
				{
					if (str == "SessionSet")
					{
						CimSession[] cimSession = cmdlet.CimSession;
						for (int i = 0; i < (int)cimSession.Length; i++)
						{
							CimSession cimSession1 = cimSession[i];
							CimSessionProxy cimSessionProxy1 = this.CreateSessionProxy(cimSession1, cmdlet);
							cimSessionProxies.Add(cimSessionProxy1);
						}
					}
					else
					{
						return;
					}
				}
				foreach (CimSessionProxy cimSessionProxy2 in cimSessionProxies)
				{
					cimSessionProxy2.EnumerateAssociatedInstancesAsync(@namespace, cmdlet.CimInstance, cmdlet.Association, cmdlet.ResultClassName, null, null);
				}
				return;
			}
		}
Ejemplo n.º 9
0
 /// <summary>
 /// <para>
 /// Base on parametersetName to retrieve associated ciminstances
 /// </para>
 /// </summary>
 /// <param name="cmdlet"><see cref="GetCimInstanceCommand"/> object</param>
 public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet)
 {
     IEnumerable<string> computerNames = ConstValue.GetComputerNames(cmdlet.ComputerName);
     // use the namespace from parameter
     string nameSpace = cmdlet.Namespace;
     if ((nameSpace == null) && (cmdlet.ResourceUri == null))
     {
         // try to use namespace of ciminstance, then fall back to default namespace
         nameSpace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);
     }
     List<CimSessionProxy> proxys = new List<CimSessionProxy>();
     switch (cmdlet.ParameterSetName)
     {
         case CimBaseCommand.ComputerSetName:
             foreach (string computerName in computerNames)
             {
                 CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet.CimInstance, cmdlet);
                     proxys.Add(proxy);
             }
             break;
         case CimBaseCommand.SessionSetName:
             foreach (CimSession session in cmdlet.CimSession)
             {
                 CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
                 proxys.Add(proxy);
             }
             break;
         default:
             return;
     }
     foreach (CimSessionProxy proxy in proxys)
     {
         proxy.EnumerateAssociatedInstancesAsync(
             nameSpace,
             cmdlet.CimInstance,
             cmdlet.Association,
             cmdlet.ResultClassName,
             null,
             null);
     }
 }
Ejemplo n.º 10
0
		private CimSessionProxy CreateSessionProxy(CimSession session, GetCimAssociatedInstanceCommand cmdlet)
		{
			CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(session);
			this.SetSessionProxyProperties(ref cimSessionProxy, cmdlet);
			return cimSessionProxy;
		}
Ejemplo n.º 11
0
		private CimSessionProxy CreateSessionProxy(string computerName, CimInstance cimInstance, GetCimAssociatedInstanceCommand cmdlet)
		{
			CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(computerName, cimInstance);
			this.SetSessionProxyProperties(ref cimSessionProxy, cmdlet);
			return cimSessionProxy;
		}
Ejemplo n.º 12
0
 /// <summary>
 /// Create <see cref="CimSessionProxy"/> and set properties
 /// </summary>
 /// <param name="session"></param>
 /// <param name="cmdlet"></param>
 /// <returns></returns>
 private CimSessionProxy CreateSessionProxy(
     CimSession session,
     GetCimAssociatedInstanceCommand cmdlet)
 {
     CimSessionProxy proxy = CreateCimSessionProxy(session);
     SetSessionProxyProperties(ref proxy, cmdlet);
     return proxy;
 }