-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathY360Module.cs
More file actions
28 lines (27 loc) · 1.28 KB
/
Copy pathY360Module.cs
File metadata and controls
28 lines (27 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Management.Automation;
using Yandex.API360;
namespace Y360Management {
/// <summary>
/// Подключиться к сервису Y360
/// </summary>
[Cmdlet("Connect", "Y360", HelpUri = "https://github.com/witomin/Y360Management#connect-y360---подключиться-к-api-яндекс-360"), OutputType(typeof(Client))]
public class ConnectY360Cmdlet : PSCmdlet {
/// <summary>
/// Обязательный параметр идентификатор организации
/// </summary>
[Parameter(Position = 0, Mandatory = true)]
public string OrgId { get; set; }
/// <summary>
/// Обязательный параметр токен авторизации
/// </summary>
[Parameter(Position = 1, Mandatory = true)]
public string APIToken { get; set; }
protected override void EndProcessing() {
var APIClient = new Client(new Api360Options(OrgId, APIToken));
PSVariable APIClientVariable = new PSVariable("APIClient", APIClient, ScopedItemOptions.Private);
APIClientVariable.Visibility = SessionStateEntryVisibility.Private;
SessionState.PSVariable.Set(APIClientVariable);
base.EndProcessing();
}
}
}