-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
New-AzContainerGroupVolumeObject.ps1
84 lines (77 loc) · 3.66 KB
/
New-AzContainerGroupVolumeObject.ps1
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
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the \"License\");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an \"AS IS\" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------
<#
.Synopsis
Create a in-memory object for Volume
.Description
Create a in-memory object for Volume
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20210301.Volume
.Link
https://docs.microsoft.com/powershell/module/az.ContainerInstance/new-AzContainerGroupVolumeObject
#>
function New-AzContainerGroupVolumeObject {
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20210301.Volume')]
[CmdletBinding(PositionalBinding=$false)]
Param(
[Parameter(HelpMessage="The flag indicating whether the Azure File shared mounted as a volume is read-only.")]
[System.Management.Automation.SwitchParameter]
$AzureFileReadOnly,
[Parameter(HelpMessage="The name of the Azure File share to be mounted as a volume.")]
[string]
$AzureFileShareName,
[Parameter(HelpMessage="The storage account access key used to access the Azure File share.")]
[SecureString]
$AzureFileStorageAccountKey,
[Parameter(HelpMessage="The name of the storage account that contains the Azure File share.")]
[string]
$AzureFileStorageAccountName,
# [Parameter(HelpMessage="The empty directory volume.")]
# [Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.IAny]
# $EmptyDir,
[Parameter(HelpMessage="Target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.")]
[string]
$GitRepoDirectoryName,
[Parameter(HelpMessage="Repository URL.")]
[string]
$GitRepoRepositoryUrl,
[Parameter(HelpMessage="Commit hash for the specified revision.")]
[string]
$GitRepoRevision,
[Parameter(Mandatory, HelpMessage="The name of the volume.")]
[string]
$Name
# ,
# [Parameter(HelpMessage="The secret volume.")]
# [Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20210301.ISecretVolume]
# $Secret
)
process {
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ContainerInstance.Models.Api20210301.Volume]::New()
$Object.AzureFileShareName = $AzureFileShareName
if ($PSBoundParameters.ContainsKey('AzureFileStorageAccountKey')) {
$psTxt = . "$PSScriptRoot/../utils/Unprotect-SecureString.ps1" $PSBoundParameters['AzureFileStorageAccountKey']
}
$Object.AzureFileStorageAccountKey = $psTxt
Write-host $psTxt
$Object.AzureFileStorageAccountName = $AzureFileStorageAccountName
# $Object.EmptyDir = $EmptyDir
$Object.GitRepoDirectory = $GitRepoDirectoryName
$Object.GitRepoRepository = $GitRepoRepositoryUrl
$Object.GitRepoRevision = $GitRepoRevision
$Object.Name = $Name
# $Object.Secret = $Secret
return $Object
}
}