GetNewInstaller() public static method

public static GetNewInstaller ( object>.IReadOnlyDictionary initParams ) : AwsIamCertificateInstaller
initParams object>.IReadOnlyDictionary
return AwsIamCertificateInstaller
コード例 #1
0
        public IInstaller GetInstaller(IReadOnlyDictionary <string, object> initParams)
        {
            var inst = new AwsElbInstaller();

            if (initParams == null)
            {
                initParams = new Dictionary <string, object>();
            }

            // Required params
            if (!initParams.ContainsKey(ELB_NAME.Name))
            {
                throw new KeyNotFoundException($"missing required parameter [{ELB_NAME.Name}]");
            }
            inst.LoadBalancerName = (string)initParams[ELB_NAME.Name];
            if (!initParams.ContainsKey(LIS_PORT.Name))
            {
                throw new KeyNotFoundException($"missing required parameter [{LIS_PORT.Name}]");
            }
            inst.LoadBalancerPort = (int)((long)initParams[LIS_PORT.Name]);

            // Optional params
            if (initParams.ContainsKey(LIS_PROTO.Name))
            {
                inst.LoadBalancerProtocol = ((string)initParams[LIS_PROTO.Name])?.ToUpper();
                if (!AwsElbInstaller.VALID_LIS_PROTOS.Contains(inst.LoadBalancerProtocol))
                {
                    throw new ArgumentException("invalid listener protocol specified");
                }

                if (initParams.ContainsKey(INST_PORT.Name))
                {
                    inst.InstancePort = (int)((long)initParams[INST_PORT.Name]);
                }
                else
                {
                    inst.InstancePort = inst.LoadBalancerPort;
                }

                if (initParams.ContainsKey(INST_PROTO.Name))
                {
                    inst.InstanceProtocol = ((string)initParams[INST_PROTO.Name])?.ToUpper();
                }
                else
                {
                    inst.InstanceProtocol = inst.LoadBalancerProtocol;
                }
                if (!AwsElbInstaller.VALID_INST_PROTOS.Contains(inst.InstanceProtocol))
                {
                    throw new ArgumentException("invalid instance protocol specified");
                }
            }

            if (initParams.ContainsKey(EXISTING_SERVER_CERTIFICATE_NAME.Name))
            {
                inst.ExistingServerCertificateName = (string)initParams[EXISTING_SERVER_CERTIFICATE_NAME.Name];
            }
            else
            {
                inst.CertInstaller = AwsIamCertificateInstallerProvider.GetNewInstaller(initParams);
            }

            // Process the common params
            inst.CommonParams.InitParams(initParams);

            return(inst);
        }
コード例 #2
0
 public IInstaller GetInstaller(IReadOnlyDictionary <string, object> initParams)
 {
     return(AwsIamCertificateInstallerProvider.GetNewInstaller(initParams));
 }