Пример #1
0
        /// <summary> Initializes a new instance of the Stackstorm.Api.Client.St2Client class. </summary>
        /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or
        ///          illegal values. </exception>
        /// <param name="authUrl">        URL of the authentication endpoint. </param>
        /// <param name="apiUrl">        URL of the API. </param>
        /// <param name="username">        The username. </param>
        /// <param name="password">        The password. </param>
        /// <param name="ignoreCertificateValidation"> true to ignore certificate validation. </param>
        public St2Client(string authUrl, string apiUrl, string username, string password, bool ignoreCertificateValidation = false)
        {
            if (String.IsNullOrWhiteSpace(authUrl))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'authUrl'.",
                                            "authUrl");
            }

            if (String.IsNullOrWhiteSpace(apiUrl))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'apiUrl'.",
                                            "apiUrl");
            }

            if (String.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'password'.",
                                            "password");
            }

            if (String.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'username'.",
                                            "username");
            }

            _apiUrl   = new Uri(apiUrl);
            _authUrl  = new Uri(authUrl);
            _password = password;
            _username = username;

            if (ignoreCertificateValidation)
            {
                ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
            }

            Actions    = new ActionsApi(this);
            Packs      = new PacksApi(this);
            Executions = new ExecutionsApi(this);
            Rules      = new RulesApi(this);
            VSphere    = new VSphere(this);
            Core       = new Core(this);
            Email      = new Email(this);
            AzureGov   = new AzureGov(this);
        }
Пример #2
0
 public void Init()
 {
     instance = new ExecutionsApi();
 }