예제 #1
0
        /// <summary>
        /// Instantiates a new instance.
        /// </summary>
        /// <param name="apiKey">The API key to use to communicate with the Vultr
        /// API.</param>
        /// <param name="apiURL">The optional Vultr API URL to use. Set this if you want
        /// to override the default endpoint (e.g. for testing).</param>
        /// <exception cref="ArgumentNullException">If <paramref name="apiKey"/> is null
        /// or empty.</exception>
        public VultrClient(string apiKey, string apiURL = VultrApiURL)
        {
            if (string.IsNullOrEmpty(apiKey))
            {
                throw new ArgumentNullException("apiKey", "apiKey must not be null");
            }

            Account         = new AccountClient(apiKey, apiURL);
            Application     = new ApplicationClient(apiKey, apiURL);
            Auth            = new AuthClient(apiKey, apiURL);
            Backup          = new BackupClient(apiKey, apiURL);
            Block           = new BlockClient(apiKey, apiURL);
            DNS             = new DNSClient(apiKey, apiURL);
            Firewall        = new FirewallClient(apiKey, apiURL);
            ISOImage        = new ISOImageClient(apiKey, apiURL);
            Network         = new NetworkClient(apiKey, apiURL);
            OperatingSystem = new OperatingSystemClient(apiKey, apiURL);
            Plan            = new PlanClient(apiKey, apiURL);
            Region          = new RegionClient(apiKey, apiURL);
            ReservedIP      = new ReservedIPClient(apiKey, apiURL);
            Server          = new ServerClient(apiKey, apiURL);
            Snapshot        = new SnapshotClient(apiKey, apiURL);
            SSHKey          = new SSHKeyClient(apiKey, apiURL);
            StartupScript   = new StartupScriptClient(apiKey, apiURL);
            User            = new UserClient(apiKey, apiURL);
        }
예제 #2
0
        /// <summary>
        ///    Initializes this instance.
        /// </summary>
        private void Init()
        {
            SetConsoleOutput();
            Client     = new PlanClient();
            IsPlanSent = false;

            Client.ServerStateChanged   += OnStateChanged;
            Client.ServerDisconnected   += OnDisconnected;
            Client.PlanResultsProcessed += UpdatePlanTable;
            Globals.Debug = true;
        }
예제 #3
0
        /// <summary>
        ///    Processes the record.
        /// </summary>
        protected override void ProcessRecord()
        {
            //
            Globals.Debug |= !string.IsNullOrEmpty(Dump);

            var path = SessionState.Path.CurrentLocation.Path;

            path = System.IO.Path.Combine(path, Path);

            var spots = PlanClient.LoadPlan(path);

            foreach (var spot in spots)
            {
                WriteObject(spot);
            }
        }
예제 #4
0
파일: DumpPlan.cs 프로젝트: x2v0/TM
 public List <Spot> Load(string file)
 {
     return(PlanClient.LoadPlan(file));
 }
예제 #5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="PlanExamples" /> class.
 /// </summary>
 /// <param name="PlanClient">The document api.</param>
 public PlanExamples(PlanClient PlanClient) => this.PlanClient = PlanClient;