forked from Azure/azure-sdk-for-go
/
models.go
350 lines (315 loc) · 14.3 KB
/
models.go
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
package personalizer
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"io"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/personalizer/v1.0/personalizer"
// ContainerStatus ...
type ContainerStatus struct {
Service *string `json:"service,omitempty"`
APIStatus *string `json:"apiStatus,omitempty"`
APIStatusMessage *string `json:"apiStatusMessage,omitempty"`
}
// DateRange ...
type DateRange struct {
// From - READ-ONLY
From *date.Time `json:"from,omitempty"`
// To - READ-ONLY
To *date.Time `json:"to,omitempty"`
}
// MarshalJSON is the custom marshaler for DateRange.
func (dr DateRange) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// Error the error object.
type Error struct {
// Code - High level error code. Possible values include: 'BadRequest', 'ResourceNotFound', 'InternalServerError', 'InvalidServiceConfiguration', 'InvalidPolicyConfiguration', 'InvalidPolicyContract', 'InvalidEvaluationContract', 'InvalidRewardRequest', 'InvalidEventIDToActivate', 'InvalidRankRequest', 'InvalidExportLogsRequest', 'InvalidContainer', 'FrontEndNotFound', 'EvaluationNotFound', 'LogsPropertiesNotFound', 'RankNullResponse', 'UpdateConfigurationFailed', 'ModelResetFailed'
Code ErrorCode `json:"code,omitempty"`
// Message - A message explaining the error reported by the service.
Message *string `json:"message,omitempty"`
// Target - Error source element.
Target *string `json:"target,omitempty"`
// Details - An array of details about specific errors that led to this reported error.
Details *[]Error `json:"details,omitempty"`
// InnerError - Finer error details.
InnerError *InternalError `json:"innerError,omitempty"`
}
// ErrorResponse used to return an error to the client
type ErrorResponse struct {
// Error - The error object.
Error *Error `json:"error,omitempty"`
}
// Evaluation ...
type Evaluation struct {
autorest.Response `json:"-"`
// ID - READ-ONLY
ID *string `json:"id,omitempty"`
// Name - READ-ONLY
Name *string `json:"name,omitempty"`
// StartTime - READ-ONLY
StartTime *date.Time `json:"startTime,omitempty"`
// EndTime - READ-ONLY
EndTime *date.Time `json:"endTime,omitempty"`
// JobID - READ-ONLY
JobID *string `json:"jobId,omitempty"`
// Status - READ-ONLY; Possible values include: 'Completed', 'Pending', 'Failed', 'NotSubmitted'
Status EvaluationJobStatus `json:"status,omitempty"`
PolicyResults *[]PolicyResult `json:"policyResults,omitempty"`
FeatureImportance *[][]string `json:"featureImportance,omitempty"`
}
// MarshalJSON is the custom marshaler for Evaluation.
func (e Evaluation) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if e.PolicyResults != nil {
objectMap["policyResults"] = e.PolicyResults
}
if e.FeatureImportance != nil {
objectMap["featureImportance"] = e.FeatureImportance
}
return json.Marshal(objectMap)
}
// EvaluationContract a counterfactual evaluation.
type EvaluationContract struct {
// EnableOfflineExperimentation - True if the evaluation should explore for a more optimal Learning settings.
EnableOfflineExperimentation *bool `json:"enableOfflineExperimentation,omitempty"`
// Name - The name of the evaluation.
Name *string `json:"name,omitempty"`
// StartTime - The start time of the evaluation.
StartTime *date.Time `json:"startTime,omitempty"`
// EndTime - The end time of the evaluation.
EndTime *date.Time `json:"endTime,omitempty"`
// Policies - Additional Learning settings to evaluate.
Policies *[]PolicyContract `json:"policies,omitempty"`
}
// InternalError an object containing more specific information than the parent object about the error.
type InternalError struct {
// Code - Detailed error code.
Code *string `json:"code,omitempty"`
// Innererror - The error object.
Innererror *InternalError `json:"innererror,omitempty"`
}
// ListEvaluation ...
type ListEvaluation struct {
autorest.Response `json:"-"`
Value *[]Evaluation `json:"value,omitempty"`
}
// LogsProperties ...
type LogsProperties struct {
autorest.Response `json:"-"`
// DateRange - READ-ONLY
DateRange *LogsPropertiesDateRange `json:"dateRange,omitempty"`
}
// MarshalJSON is the custom marshaler for LogsProperties.
func (lp LogsProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// LogsPropertiesDateRange ...
type LogsPropertiesDateRange struct {
// From - READ-ONLY
From *date.Time `json:"from,omitempty"`
// To - READ-ONLY
To *date.Time `json:"to,omitempty"`
}
// MarshalJSON is the custom marshaler for LogsPropertiesDateRange.
func (lpR LogsPropertiesDateRange) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ModelProperties ...
type ModelProperties struct {
autorest.Response `json:"-"`
// CreationTime - READ-ONLY
CreationTime *date.Time `json:"creationTime,omitempty"`
// LastModifiedTime - READ-ONLY
LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"`
}
// MarshalJSON is the custom marshaler for ModelProperties.
func (mp ModelProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// PolicyContract learning settings specifying how to train the model.
type PolicyContract struct {
autorest.Response `json:"-"`
// Name - Name of the Learning settings.
Name *string `json:"name,omitempty"`
// Arguments - Arguments of the Learning settings.
Arguments *string `json:"arguments,omitempty"`
}
// PolicyResult ...
type PolicyResult struct {
// Name - READ-ONLY
Name *string `json:"name,omitempty"`
// Arguments - READ-ONLY
Arguments *string `json:"arguments,omitempty"`
// Summary - READ-ONLY
Summary *[]PolicyResultSummary `json:"summary,omitempty"`
// TotalSummary - READ-ONLY
TotalSummary *PolicyResultTotalSummary `json:"totalSummary,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyResult.
func (pr PolicyResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// PolicyResultSummary ...
type PolicyResultSummary struct {
// TimeStamp - READ-ONLY
TimeStamp *date.Time `json:"timeStamp,omitempty"`
// IpsEstimatorNumerator - READ-ONLY
IpsEstimatorNumerator *float64 `json:"ipsEstimatorNumerator,omitempty"`
// IpsEstimatorDenominator - READ-ONLY
IpsEstimatorDenominator *float64 `json:"ipsEstimatorDenominator,omitempty"`
// SnipsEstimatorDenominator - READ-ONLY
SnipsEstimatorDenominator *float64 `json:"snipsEstimatorDenominator,omitempty"`
// AggregateTimeWindow - READ-ONLY
AggregateTimeWindow *string `json:"aggregateTimeWindow,omitempty"`
NonZeroProbability *float64 `json:"nonZeroProbability,omitempty"`
// ConfidenceInterval - READ-ONLY
ConfidenceInterval *float64 `json:"confidenceInterval,omitempty"`
// SumOfSquares - READ-ONLY
SumOfSquares *float64 `json:"sumOfSquares,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyResultSummary.
func (prs PolicyResultSummary) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if prs.NonZeroProbability != nil {
objectMap["nonZeroProbability"] = prs.NonZeroProbability
}
return json.Marshal(objectMap)
}
// PolicyResultTotalSummary ...
type PolicyResultTotalSummary struct {
// TimeStamp - READ-ONLY
TimeStamp *date.Time `json:"timeStamp,omitempty"`
// IpsEstimatorNumerator - READ-ONLY
IpsEstimatorNumerator *float64 `json:"ipsEstimatorNumerator,omitempty"`
// IpsEstimatorDenominator - READ-ONLY
IpsEstimatorDenominator *float64 `json:"ipsEstimatorDenominator,omitempty"`
// SnipsEstimatorDenominator - READ-ONLY
SnipsEstimatorDenominator *float64 `json:"snipsEstimatorDenominator,omitempty"`
// AggregateTimeWindow - READ-ONLY
AggregateTimeWindow *string `json:"aggregateTimeWindow,omitempty"`
NonZeroProbability *float64 `json:"nonZeroProbability,omitempty"`
// ConfidenceInterval - READ-ONLY
ConfidenceInterval *float64 `json:"confidenceInterval,omitempty"`
// SumOfSquares - READ-ONLY
SumOfSquares *float64 `json:"sumOfSquares,omitempty"`
}
// MarshalJSON is the custom marshaler for PolicyResultTotalSummary.
func (prS PolicyResultTotalSummary) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if prS.NonZeroProbability != nil {
objectMap["nonZeroProbability"] = prS.NonZeroProbability
}
return json.Marshal(objectMap)
}
// RankableAction an action with it's associated features used for ranking.
type RankableAction struct {
// ID - Id of the action.
ID *string `json:"id,omitempty"`
// Features - List of dictionaries containing features.
Features *[]interface{} `json:"features,omitempty"`
}
// RankedAction a ranked action with its resulting probability.
type RankedAction struct {
// ID - READ-ONLY; Id of the action
ID *string `json:"id,omitempty"`
// Probability - READ-ONLY; Probability of the action
Probability *float64 `json:"probability,omitempty"`
}
// MarshalJSON is the custom marshaler for RankedAction.
func (ra RankedAction) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// RankRequest request a set of actions to be ranked by the Personalizer service.
type RankRequest struct {
// ContextFeatures - Features of the context used for Personalizer as a
// dictionary of dictionaries. This depends on the application, and
// typically includes features about the current user, their
// device, profile information, aggregated data about time and date, etc.
// Features should not include personally identifiable information (PII),
// unique UserIDs, or precise timestamps.
ContextFeatures *[]interface{} `json:"contextFeatures,omitempty"`
// Actions - The set of actions the Personalizer service can pick from.
// The set should not contain more than 50 actions.
// The order of the actions does not affect the rank result but the order
// should match the sequence your application would have used to display them.
// The first item in the array will be used as Baseline item in Offline evaluations.
Actions *[]RankableAction `json:"actions,omitempty"`
// ExcludedActions - The set of action ids to exclude from ranking.
ExcludedActions *[]string `json:"excludedActions,omitempty"`
// EventID - Optionally pass an eventId that uniquely identifies this Rank event.
// If null, the service generates a unique eventId. The eventId will be used for
// associating this request with its reward, as well as seeding the pseudo-random
// generator when making a Personalizer call.
EventID *string `json:"eventId,omitempty"`
// DeferActivation - Send false if it is certain the rewardActionId in rank results will be shown to the user, therefore
// Personalizer will expect a Reward call, otherwise it will assign the default
// Reward to the event. Send true if it is possible the user will not see the
// action specified in the rank results, because the page is rendering later, or the Rank results may be
// overridden by code further downstream.
DeferActivation *bool `json:"deferActivation,omitempty"`
}
// RankResponse returns which action to use as rewardActionId, and additional information about each action
// as a result of a Rank request.
type RankResponse struct {
autorest.Response `json:"-"`
// Ranking - READ-ONLY; The calculated ranking for the current request.
Ranking *[]RankedAction `json:"ranking,omitempty"`
// EventID - READ-ONLY; The eventId for the round trip from request to response.
EventID *string `json:"eventId,omitempty"`
// RewardActionID - READ-ONLY; The action chosen by the Personalizer service. This is the action your application should display, and for which to report the reward. This might not be the
// first found in 'ranking' if an action in the request in first position was part of the excluded ids.
RewardActionID *string `json:"rewardActionId,omitempty"`
}
// MarshalJSON is the custom marshaler for RankResponse.
func (rr RankResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ReadCloser ...
type ReadCloser struct {
autorest.Response `json:"-"`
Value *io.ReadCloser `json:"value,omitempty"`
}
// RewardRequest reward given to a rank response.
type RewardRequest struct {
// Value - Reward to be assigned to an action. Value should be between -1 and 1 inclusive.
Value *float64 `json:"value,omitempty"`
}
// ServiceConfiguration the configuration of the service.
type ServiceConfiguration struct {
autorest.Response `json:"-"`
// RewardWaitTime - The time span waited until a request is marked with the default reward.
// For example, PT5M (5 mins). For information about the time format,
// see http://en.wikipedia.org/wiki/ISO_8601#Durations
RewardWaitTime *string `json:"rewardWaitTime,omitempty"`
// DefaultReward - The reward given if a reward is not received within the specified wait time.
DefaultReward *float64 `json:"defaultReward,omitempty"`
// RewardAggregation - The function used to process rewards, if multiple reward scores are received before rewardWaitTime is over.
RewardAggregation *string `json:"rewardAggregation,omitempty"`
// ExplorationPercentage - The percentage of rank responses that will use exploration.
ExplorationPercentage *float64 `json:"explorationPercentage,omitempty"`
// ModelExportFrequency - Personalizer will start using the most updated trained model for online ranks automatically every specified time period.
// For example, PT5M (5 mins). For information about the time format,
// see http://en.wikipedia.org/wiki/ISO_8601#Durations
ModelExportFrequency *string `json:"modelExportFrequency,omitempty"`
// LogMirrorEnabled - Flag indicates whether log mirroring is enabled.
LogMirrorEnabled *bool `json:"logMirrorEnabled,omitempty"`
// LogMirrorSasURI - Azure storage account container SAS URI for log mirroring.
LogMirrorSasURI *string `json:"logMirrorSasUri,omitempty"`
// LogRetentionDays - Number of days historical logs are to be maintained. -1 implies the logs will never be deleted.
LogRetentionDays *int32 `json:"logRetentionDays,omitempty"`
}