-
Notifications
You must be signed in to change notification settings - Fork 2
/
NUCommand.j
188 lines (168 loc) · 8.09 KB
/
NUCommand.j
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
Copyright (c) 2015, Alcatel-Lucent Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
@import <Foundation/Foundation.j>
@import <AppKit/CPArrayController.j>
@import <Bambou/NURESTObject.j>
NUCommandCommand_NSG_APPLY_PATCH = @"NSG_APPLY_PATCH";
NUCommandCommand_NSG_CONTAINER_TEST_SUITE_RUN = @"NSG_CONTAINER_TEST_SUITE_RUN";
NUCommandCommand_NSG_CONTAINER_UNDERLAY_TEST = @"NSG_CONTAINER_UNDERLAY_TEST";
NUCommandCommand_NSG_DELETE_PATCH = @"NSG_DELETE_PATCH";
NUCommandCommand_NSG_DOWNLOAD_OS_IMAGE = @"NSG_DOWNLOAD_OS_IMAGE";
NUCommandCommand_NSG_OVERLAY_SYSLOG_CONTAINER_RESTART = @"NSG_OVERLAY_SYSLOG_CONTAINER_RESTART";
NUCommandCommand_NSG_OVERLAY_SYSLOG_CONTAINER_START = @"NSG_OVERLAY_SYSLOG_CONTAINER_START";
NUCommandCommand_NSG_OVERLAY_SYSLOG_CONTAINER_STOP = @"NSG_OVERLAY_SYSLOG_CONTAINER_STOP";
NUCommandCommand_NSG_REBOOT = @"NSG_REBOOT";
NUCommandCommand_NSG_RENEW_CERT = @"NSG_RENEW_CERT";
NUCommandCommand_NSG_UPDATE_INFO = @"NSG_UPDATE_INFO";
NUCommandCommand_NSG_UPGRADE_TO_IMAGE = @"NSG_UPGRADE_TO_IMAGE";
NUCommandCommand_UNKNOWN = @"UNKNOWN";
NUCommandEntityScope_ENTERPRISE = @"ENTERPRISE";
NUCommandEntityScope_GLOBAL = @"GLOBAL";
NUCommandOverride_ABANDON = @"ABANDON";
NUCommandOverride_UNSPECIFIED = @"UNSPECIFIED";
NUCommandStatus_ABANDONED = @"ABANDONED";
NUCommandStatus_COMPLETED = @"COMPLETED";
NUCommandStatus_FAILED = @"FAILED";
NUCommandStatus_RUNNING = @"RUNNING";
NUCommandStatus_SKIPPED = @"SKIPPED";
NUCommandStatus_STARTED = @"STARTED";
NUCommandStatus_UNKNOWN = @"UNKNOWN";
/*!
A Command represents an operation that needs to be executed on an entity (NSG, Gateway, ...) which requires little processing by VSD, but may result in a long activity on the external entity. An example would be to trigger an action on VSD so that a Gateway download a new image. VSDs handling of the request is limited to generating a message to be sent to the device on which the download process is expected. The device then acts on the request and proceeds with the download... That may be a long process. The commands API is similar to the Jobs API with regards to triggering operations on objects.
*/
@implementation NUCommand : NURESTObject
{
/*!
ID of the user who last updated the object.
*/
CPString _lastUpdatedBy @accessors(property=lastUpdatedBy);
/*!
Time stamp when this object was last updated.
*/
CPString _lastUpdatedDate @accessors(property=lastUpdatedDate);
/*!
Details about the command execution as reported directly from the NSG independent of status codes.
*/
CPString _detail @accessors(property=detail);
/*!
A string representing the detailed status of the operation that was triggered by the execution of the Command instance.
*/
CPString _detailedStatus @accessors(property=detailedStatus);
/*!
A numerical code mapping to a list of detailed statuses that can apply to a Command instance.
*/
CPNumber _detailedStatusCode @accessors(property=detailedStatusCode);
/*!
Specify if scope of entity is Data center or Enterprise level
*/
CPString _entityScope @accessors(property=entityScope);
/*!
Specifies the type of command that is stated for execution on the system receiving the operation request. A request for download, a request for upgrade, a request for revocation, ...
*/
CPString _command @accessors(property=command);
/*!
Informative details on what command is to be executed. It complements the commandType attribute. An example of a value could be a URL, a version number, a UUID of another object, ...
*/
CPString _commandInformation @accessors(property=commandInformation);
/*!
Time stamp when this object was created.
*/
CPString _creationDate @accessors(property=creationDate);
/*!
JSON string detailing the progress of the command execution on Gateway.
*/
CPString _progress @accessors(property=progress);
/*!
Managed Object Type of the entity on which this Command is associated.
*/
CPString _assocEntityType @accessors(property=assocEntityType);
/*!
Parameters to be supplied for execution of this command. This should be the ID of the object supplying parameters.
*/
CPString _associatedParam @accessors(property=associatedParam);
/*!
Type of the object which supplies parameters for this command. For NSG_APPLY_PATCH command this should be NSG_PATCH_PROFILE. For NSG_DELETE_PATCH it should be PATCH
*/
CPString _associatedParamType @accessors(property=associatedParamType);
/*!
The status of the Command from a VSD perspective.
*/
CPString _status @accessors(property=status);
/*!
Full command including parameters that is to be executed.
*/
CPString _fullCommand @accessors(property=fullCommand);
/*!
A generated summary for the action giving some general context on the command executed.
*/
CPString _summary @accessors(property=summary);
/*!
Operator specified action which overrides the normal life cycle of a command.
*/
CPString _override @accessors(property=override);
/*!
Identifies the user that has created this object.
*/
CPString _owner @accessors(property=owner);
/*!
External object ID. Used for integration with third party systems
*/
CPString _externalID @accessors(property=externalID);
}
#pragma mark -
#pragma mark Class Method
+ (CPString)RESTName
{
return @"command";
}
#pragma mark -
#pragma mark Initialization
- (id)init
{
if (self = [super init])
{
[self exposeLocalKeyPathToREST:@"lastUpdatedBy"];
[self exposeLocalKeyPathToREST:@"lastUpdatedDate"];
[self exposeLocalKeyPathToREST:@"detail"];
[self exposeLocalKeyPathToREST:@"detailedStatus"];
[self exposeLocalKeyPathToREST:@"detailedStatusCode"];
[self exposeLocalKeyPathToREST:@"entityScope"];
[self exposeLocalKeyPathToREST:@"command"];
[self exposeLocalKeyPathToREST:@"commandInformation"];
[self exposeLocalKeyPathToREST:@"creationDate"];
[self exposeLocalKeyPathToREST:@"progress"];
[self exposeLocalKeyPathToREST:@"assocEntityType"];
[self exposeLocalKeyPathToREST:@"associatedParam"];
[self exposeLocalKeyPathToREST:@"associatedParamType"];
[self exposeLocalKeyPathToREST:@"status"];
[self exposeLocalKeyPathToREST:@"fullCommand"];
[self exposeLocalKeyPathToREST:@"summary"];
[self exposeLocalKeyPathToREST:@"override"];
[self exposeLocalKeyPathToREST:@"owner"];
[self exposeLocalKeyPathToREST:@"externalID"];
}
return self;
}
@end