@@ -47,21 +47,52 @@ public override void ExecuteCmdlet()
47
47
string galleryName = this . Name ;
48
48
Gallery gallery = new Gallery ( ) ;
49
49
gallery . Location = this . Location ;
50
- if ( this . IsParameterBound ( c => c . Permission ) ) {
51
- gallery . SharingProfile = new SharingProfile ( ) ;
52
- gallery . SharingProfile . Permissions = this . Permission ;
53
- }
50
+ CommunityGalleryInfo communityGalleryInfo = new CommunityGalleryInfo ( ) ;
51
+
54
52
55
53
if ( this . IsParameterBound ( c => c . Description ) )
56
54
{
57
55
gallery . Description = this . Description ;
58
56
}
59
57
58
+ if ( this . IsParameterBound ( c => c . PublisherUri ) )
59
+ {
60
+ communityGalleryInfo . PublisherUri = this . PublisherUri ;
61
+ }
62
+
63
+ if ( this . IsParameterBound ( c => c . PublisherContact ) )
64
+ {
65
+ communityGalleryInfo . PublisherContact = this . PublisherContact ;
66
+ }
67
+
68
+ if ( this . IsParameterBound ( c => c . Eula ) )
69
+ {
70
+ communityGalleryInfo . Eula = this . Eula ;
71
+ }
72
+
73
+ if ( this . IsParameterBound ( c => c . PublicNamePrefix ) )
74
+ {
75
+ communityGalleryInfo . PublicNamePrefix = this . PublicNamePrefix ;
76
+ }
77
+
78
+ if ( this . IsParameterBound ( c => c . Permission ) )
79
+ {
80
+ gallery . SharingProfile = new SharingProfile ( ) ;
81
+ gallery . SharingProfile . Permissions = this . Permission ;
82
+
83
+ if ( gallery . SharingProfile . Permissions . ToLower ( ) == "community" )
84
+ {
85
+ gallery . SharingProfile . CommunityGalleryInfo = communityGalleryInfo ;
86
+ }
87
+ }
88
+
89
+
60
90
if ( this . IsParameterBound ( c => c . Tag ) )
61
91
{
62
92
gallery . Tags = this . Tag . Cast < DictionaryEntry > ( ) . ToDictionary ( ht => ( string ) ht . Key , ht => ( string ) ht . Value ) ;
63
93
}
64
94
95
+
65
96
var result = GalleriesClient . CreateOrUpdate ( resourceGroupName , galleryName , gallery ) ;
66
97
var psObject = new PSGallery ( ) ;
67
98
ComputeAutomationAutoMapperProfile . Mapper . Map < Gallery , PSGallery > ( result , psObject ) ;
@@ -110,9 +141,34 @@ public override void ExecuteCmdlet()
110
141
[ Parameter (
111
142
Mandatory = false ,
112
143
ValueFromPipelineByPropertyName = true ,
113
- HelpMessage = "This property allows you to specify the permission of sharing gallery. Possible values are: 'Private' and 'Groups '." ) ]
114
- [ PSArgumentCompleter ( "Private" , "Groups" ) ]
144
+ HelpMessage = "This property allows you to specify the permission of sharing gallery. Possible values are: 'Private', 'Groups' and 'Community '." ) ]
145
+ [ PSArgumentCompleter ( "Private" , "Groups" , "Community" ) ]
115
146
public string Permission { get ; set ; }
147
+
148
+ [ Parameter (
149
+ Mandatory = false ,
150
+ ValueFromPipelineByPropertyName = true ,
151
+ HelpMessage = "Gets or sets the link to the publisher website. Visible to all users." ) ]
152
+ public string PublisherUri { get ; set ; }
153
+
154
+ [ Parameter (
155
+ Mandatory = false ,
156
+ ValueFromPipelineByPropertyName = true ,
157
+ HelpMessage = "Gets or sets community gallery publisher support email. The email address of the publisher. Visible to all users." ) ]
158
+ public string PublisherContact { get ; set ; }
159
+
160
+ [ Parameter (
161
+ Mandatory = false ,
162
+ ValueFromPipelineByPropertyName = true ,
163
+ HelpMessage = "Gets or sets end-user license agreement for community gallery image." ) ]
164
+ public string Eula { get ; set ; }
165
+
166
+ [ Parameter (
167
+ Mandatory = false ,
168
+ ValueFromPipelineByPropertyName = true ,
169
+ HelpMessage = "Gets or sets the prefix of the gallery name that will be displayed publicly. Visible to all users." ) ]
170
+ public string PublicNamePrefix { get ; set ; }
171
+
116
172
}
117
173
118
174
[ Cmdlet ( VerbsData . Update , ResourceManager . Common . AzureRMConstants . AzureRMPrefix + "Gallery" , DefaultParameterSetName = "DefaultParameter" , SupportsShouldProcess = true ) ]
@@ -145,6 +201,7 @@ public override void ExecuteCmdlet()
145
201
}
146
202
147
203
Gallery gallery = new Gallery ( ) ;
204
+ CommunityGalleryInfo communityGalleryInfo = new CommunityGalleryInfo ( ) ;
148
205
149
206
if ( this . ParameterSetName == "ObjectParameter" )
150
207
{
@@ -160,17 +217,44 @@ public override void ExecuteCmdlet()
160
217
gallery . Description = this . Description ;
161
218
}
162
219
220
+ if ( this . IsParameterBound ( c => c . PublisherUri ) )
221
+ {
222
+ communityGalleryInfo . PublisherUri = this . PublisherUri ;
223
+ }
224
+
225
+ if ( this . IsParameterBound ( c => c . PublisherContact ) )
226
+ {
227
+ communityGalleryInfo . PublisherContact = this . PublisherContact ;
228
+ }
229
+
230
+ if ( this . IsParameterBound ( c => c . Eula ) )
231
+ {
232
+ communityGalleryInfo . Eula = this . Eula ;
233
+ }
234
+
235
+ if ( this . IsParameterBound ( c => c . PublicNamePrefix ) )
236
+ {
237
+ communityGalleryInfo . PublicNamePrefix = this . PublicNamePrefix ;
238
+ }
239
+
163
240
if ( this . IsParameterBound ( c => c . Tag ) )
164
241
{
165
242
gallery . Tags = this . Tag . Cast < DictionaryEntry > ( ) . ToDictionary ( ht => ( string ) ht . Key , ht => ( string ) ht . Value ) ;
166
243
}
244
+
167
245
if ( this . IsParameterBound ( c => c . Permission ) )
168
246
{
169
247
if ( gallery . SharingProfile == null )
170
248
{
171
249
gallery . SharingProfile = new SharingProfile ( ) ;
172
250
}
173
251
gallery . SharingProfile . Permissions = this . Permission ;
252
+
253
+ if ( gallery . SharingProfile . Permissions . ToLower ( ) == "community" )
254
+ {
255
+ gallery . SharingProfile . CommunityGalleryInfo = communityGalleryInfo ;
256
+ }
257
+
174
258
}
175
259
176
260
@@ -182,7 +266,7 @@ public override void ExecuteCmdlet()
182
266
// if sub or tenant is present return error
183
267
if ( this . IsParameterBound ( c => c . Subscription ) || this . IsParameterBound ( c => c . Tenant ) )
184
268
{
185
- throw new Exception ( "Parameter '-Reset' cannot be used with parameters '-Tenant' or '-Subscription'." ) ;
269
+ throw new Exception ( "Parameter '-Reset' cannot be used with parameters '-Tenant', '-Subscription' or 'Community '." ) ;
186
270
}
187
271
else
188
272
{
@@ -253,6 +337,11 @@ public override void ExecuteCmdlet()
253
337
sharingUpdate . Groups . Add ( sharingProfile ) ;
254
338
sharingUpdate . OperationType = "Remove" ;
255
339
}
340
+ if ( this . IsParameterBound ( c => c . Community ) )
341
+ {
342
+ if ( this . Community . IsPresent )
343
+ sharingUpdate . OperationType = "EnableCommunity" ;
344
+ }
256
345
257
346
}
258
347
else if ( this . IsParameterBound ( c => c . Subscription ) || this . IsParameterBound ( c => c . Tenant ) || this . Reset . IsPresent || this . IsParameterBound ( c => c . RemoveSubscription ) || this . IsParameterBound ( c => c . RemoveTenant ) )
@@ -320,8 +409,8 @@ public override void ExecuteCmdlet()
320
409
[ Parameter (
321
410
Mandatory = false ,
322
411
ValueFromPipelineByPropertyName = true ,
323
- HelpMessage = "This property allows you to specify the permission of the sharing gallery. Possible values are: 'Private' and 'Groups '." ) ]
324
- [ PSArgumentCompleter ( "Private" , "Groups" ) ]
412
+ HelpMessage = "This property allows you to specify the permission of the sharing gallery. Possible values are: 'Private', 'Groups' and 'Community '." ) ]
413
+ [ PSArgumentCompleter ( "Private" , "Groups" , "Community" ) ]
325
414
public string Permission { get ; set ; }
326
415
327
416
[ Parameter (
@@ -354,10 +443,40 @@ public override void ExecuteCmdlet()
354
443
HelpMessage = "Update sharing profile of the gallery." ) ]
355
444
public SwitchParameter Share { get ; set ; }
356
445
446
+ [ Parameter (
447
+ Mandatory = false ,
448
+ ValueFromPipelineByPropertyName = true ,
449
+ HelpMessage = "Update sharing profile of the gallery to community." ) ]
450
+ public SwitchParameter Community { get ; set ; }
451
+
357
452
[ Parameter (
358
453
Mandatory = false ,
359
454
ValueFromPipelineByPropertyName = true ,
360
455
HelpMessage = "Resets the sharing permission of the gallery to 'Private'." ) ]
361
456
public SwitchParameter Reset { get ; set ; }
457
+
458
+ [ Parameter (
459
+ Mandatory = false ,
460
+ ValueFromPipelineByPropertyName = true ,
461
+ HelpMessage = "Gets or sets the link to the publisher website. Visible to all users." ) ]
462
+ public string PublisherUri { get ; set ; }
463
+
464
+ [ Parameter (
465
+ Mandatory = false ,
466
+ ValueFromPipelineByPropertyName = true ,
467
+ HelpMessage = "Gets or sets community gallery publisher support email. The email address of the publisher. Visible to all users." ) ]
468
+ public string PublisherContact { get ; set ; }
469
+
470
+ [ Parameter (
471
+ Mandatory = false ,
472
+ ValueFromPipelineByPropertyName = true ,
473
+ HelpMessage = "Gets or sets end-user license agreement for community gallery image." ) ]
474
+ public string Eula { get ; set ; }
475
+
476
+ [ Parameter (
477
+ Mandatory = false ,
478
+ ValueFromPipelineByPropertyName = true ,
479
+ HelpMessage = "Gets or sets the prefix of the gallery name that will be displayed publicly. Visible to all users." ) ]
480
+ public string PublicNamePrefix { get ; set ; }
362
481
}
363
482
}
0 commit comments