1
1
namespace ProcessMyMedia . Services
2
2
{
3
3
using System ;
4
+ using System . Security ;
4
5
using System . Linq ;
5
6
using System . Threading . Tasks ;
6
7
using System . Collections . Generic ;
@@ -63,6 +64,11 @@ public async Task AuthAsync()
63
64
/// <returns></returns>
64
65
public async Task < Model . LinkedServiceEntity > GetLinkedServiceAsync ( string name )
65
66
{
67
+ if ( this . client == null )
68
+ {
69
+ throw new SecurityException ( "Not Authenticated" ) ;
70
+ }
71
+
66
72
var linkedService = await this . client . LinkedServices . GetAsync (
67
73
this . configuration . ResourceGroup ,
68
74
this . configuration . FactoryName ,
@@ -81,6 +87,11 @@ public async Task AuthAsync()
81
87
/// <returns></returns>
82
88
public async Task < Model . LinkedServiceEntity > CreateOrUpdateLinkedServiceAsync ( string name , string type , object typeProperties )
83
89
{
90
+ if ( this . client == null )
91
+ {
92
+ throw new SecurityException ( "Not Authenticated" ) ;
93
+ }
94
+
84
95
var linkedService = await this . client . LinkedServices . CreateOrUpdateAsync (
85
96
this . configuration . ResourceGroup ,
86
97
this . configuration . FactoryName ,
@@ -102,6 +113,11 @@ public async Task AuthAsync()
102
113
/// <returns></returns>
103
114
public async Task < Model . DatasetEntity > GetDatasetAsync ( string name )
104
115
{
116
+ if ( this . client == null )
117
+ {
118
+ throw new SecurityException ( "Not Authenticated" ) ;
119
+ }
120
+
105
121
var dataset = await this . client . Datasets . GetAsync (
106
122
this . configuration . ResourceGroup ,
107
123
this . configuration . FactoryName ,
@@ -118,6 +134,11 @@ public async Task AuthAsync()
118
134
/// <returns></returns>
119
135
public async Task < Model . DatasetEntity > CreateOrUpdateDatasetAsync ( Model . DatasetEntity dataset )
120
136
{
137
+ if ( this . client == null )
138
+ {
139
+ throw new SecurityException ( "Not Authenticated" ) ;
140
+ }
141
+
121
142
var response = await this . client . Datasets . CreateOrUpdateAsync (
122
143
this . configuration . ResourceGroup ,
123
144
this . configuration . FactoryName ,
@@ -139,6 +160,11 @@ public async Task AuthAsync()
139
160
/// <returns></returns>
140
161
public async Task DeleteDatasetAsync ( string name )
141
162
{
163
+ if ( this . client == null )
164
+ {
165
+ throw new SecurityException ( "Not Authenticated" ) ;
166
+ }
167
+
142
168
var datasetToDelete = await this . GetDatasetAsync ( name ) ;
143
169
if ( datasetToDelete != null )
144
170
{
@@ -156,6 +182,11 @@ await this.client.Datasets.DeleteAsync(
156
182
/// <returns></returns>
157
183
public async Task < Model . DataPipelineEntity > GetPipelineAsync ( string name )
158
184
{
185
+ if ( this . client == null )
186
+ {
187
+ throw new SecurityException ( "Not Authenticated" ) ;
188
+ }
189
+
159
190
var pipeline = await this . client . Pipelines . GetAsync (
160
191
this . configuration . ResourceGroup ,
161
192
this . configuration . FactoryName ,
@@ -171,6 +202,11 @@ await this.client.Datasets.DeleteAsync(
171
202
/// <returns></returns>
172
203
public async Task CreateOrUpdatePipelineyAsync ( Model . DataPipelineEntity pipeline )
173
204
{
205
+ if ( this . client == null )
206
+ {
207
+ throw new SecurityException ( "Not Authenticated" ) ;
208
+ }
209
+
174
210
await this . client . Pipelines . CreateOrUpdateAsync (
175
211
this . configuration . ResourceGroup ,
176
212
this . configuration . FactoryName ,
@@ -186,6 +222,11 @@ await this.client.Pipelines.CreateOrUpdateAsync(
186
222
/// <returns></returns>
187
223
public async Task DeletePipelineAsync ( string name )
188
224
{
225
+ if ( this . client == null )
226
+ {
227
+ throw new SecurityException ( "Not Authenticated" ) ;
228
+ }
229
+
189
230
var pipelineToDelete = await this . GetPipelineAsync ( name ) ;
190
231
if ( pipelineToDelete != null )
191
232
{
@@ -204,6 +245,11 @@ await this.client.Pipelines.DeleteAsync(
204
245
/// <returns></returns>
205
246
public async Task < string > RunPipelineAsync ( string pipelineName , Dictionary < string , object > properties = null )
206
247
{
248
+ if ( this . client == null )
249
+ {
250
+ throw new SecurityException ( "Not Authenticated" ) ;
251
+ }
252
+
207
253
var response = await this . client . Pipelines . CreateRunAsync (
208
254
this . configuration . ResourceGroup ,
209
255
this . configuration . FactoryName ,
@@ -220,6 +266,11 @@ public async Task<string> RunPipelineAsync(string pipelineName, Dictionary<strin
220
266
/// <returns></returns>
221
267
public async Task < Model . DataPipelineRunEntity > GetPipelineRunAsync ( string runID )
222
268
{
269
+ if ( this . client == null )
270
+ {
271
+ throw new SecurityException ( "Not Authenticated" ) ;
272
+ }
273
+
223
274
var run = await this . client . PipelineRuns . GetAsync (
224
275
this . configuration . ResourceGroup ,
225
276
this . configuration . FactoryName ,
0 commit comments