/
PigJobSubmissionParameters.cs
76 lines (62 loc) · 2.58 KB
/
PigJobSubmissionParameters.cs
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
namespace Microsoft.Azure.HDInsight.Job.Models
{
using System.Collections.Generic;
/// <summary>
/// Parameters specifying the HDInsight Pig job definition.
/// </summary>
public partial class PigJobSubmissionParameters
{
/// <summary>
/// Optional. Gets the arguments for the jobDetails.
/// </summary>
public IList<string> Arguments { get; set; }
/// <summary>
/// Optional. Gets or sets the query file to use for a Pig job.
/// </summary>
public string File { get; set; }
/// <summary>
/// Optional. Gets or sets the files to be copied to the cluster.
/// </summary>
public IList<string> Files { get; set; }
/// <summary>
/// Optional. Gets or sets the query to use for a Pig job.
/// </summary>
public string Query { get; set; }
/// <summary>
/// Optional. Status directory in the default storage account to store job files stderr, stdout and exit.
/// </summary>
public string StatusDir { get; set; }
/// <summary>
/// Initializes a new instance of the PigJobSubmissionParameters class.
/// </summary>
public PigJobSubmissionParameters()
{
}
internal string GetJobPostRequestContent()
{
// Check input parameters and transform them to required format before sending request to templeton.
var values = new List<KeyValuePair<string, string>>();
if (!string.IsNullOrEmpty(this.Query))
{
values.Add(new KeyValuePair<string, string>("execute", this.Query));
}
if (!string.IsNullOrEmpty(this.File))
{
values.Add(new KeyValuePair<string, string>("file", this.File));
}
if (this.Arguments != null && this.Arguments.Count > 0)
{
values.AddRange(ModelHelper.BuildList("arg", this.Arguments));
}
if (this.Files != null && this.Files.Count > 0)
{
values.Add(new KeyValuePair<string, string>("files", ModelHelper.BuildListToCommaSeparatedString(this.Files)));
}
values.Add(new KeyValuePair<string, string>("statusdir", ModelHelper.GetStatusDirectory(this.StatusDir)));
return ModelHelper.ConvertItemsToString(values);
}
}
}