1+
2+ # ----------------------------------------------------------------------------------
3+ #
4+ # Copyright Microsoft Corporation
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+ # ----------------------------------------------------------------------------------
15+
16+ <#
17+ . Synopsis
18+ Create an environment in the specified subscription and resource group.
19+ . Description
20+ Create an environment in the specified subscription and resource group.
21+
22+ . Link
23+ https://docs.microsoft.com/en-us/powershell/module/az.timeseriesinsights/new-aztimeseriesinsightsenvironment
24+ #>
25+ function New-AzTimeSeriesInsightsEnvironment {
26+ [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.IEnvironmentResource ])]
27+ [CmdletBinding (DefaultParameterSetName = ' standard' , PositionalBinding = $false , SupportsShouldProcess , ConfirmImpact = ' Medium' )]
28+ param (
29+ [Parameter (Mandatory )]
30+ [Alias (' EnvironmentName' )]
31+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Path' )]
32+ [System.String ]
33+ # Name of the environment
34+ ${Name} ,
35+
36+ [Parameter (Mandatory )]
37+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Path' )]
38+ [System.String ]
39+ # Name of an Azure Resource group.
40+ ${ResourceGroupName} ,
41+
42+ [Parameter ()]
43+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Path' )]
44+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.DefaultInfo (Script= ' (Get-AzContext).Subscription.Id' )]
45+ [System.String ]
46+ # Azure Subscription ID.
47+ ${SubscriptionId} ,
48+
49+ [Parameter (Mandatory )]
50+ [ArgumentCompleter ({param ( $CommandName , $ParameterName , $WordToComplete , $CommandAst , $FakeBoundParameters ) return @ (' Standard' , ' LongTerm' )})]
51+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
52+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.Kind ]
53+ # The kind of the environment.
54+ ${Kind} ,
55+
56+ [Parameter (Mandatory )]
57+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
58+ [System.String ]
59+ # The location of the resource.
60+ ${Location} ,
61+
62+ [Parameter (ParameterSetName = ' standard' , Mandatory )]
63+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
64+ [System.Int32 ]
65+ # The capacity of the sku.
66+ # For standard environments, this value can be changed to support scale out of environments after they have been created.
67+ ${Capacity} ,
68+
69+ [Parameter (ParameterSetName = ' standard' , Mandatory )]
70+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
71+ [System.TimeSpan ]
72+ # The data retention time.
73+ ${DataRetentionTime} ,
74+
75+ [Parameter (ParameterSetName = ' standard' )]
76+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
77+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty []]
78+ # The list of event properties which will be used to partition data in the environment.
79+ ${PartitionKeyProperty} ,
80+
81+ [Parameter (ParameterSetName = ' standard' )]
82+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
83+ [System.String ]
84+ # The behavior the Time Series Insights service should take when the environment's capacity has been exceeded
85+ ${StorageLimitExceededBehavior} ,
86+
87+ [Parameter (Mandatory )]
88+ [ArgumentCompleter ([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName ])]
89+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
90+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Support.SkuName ]
91+ # The name of this SKU.
92+ ${Sku} ,
93+
94+ [Parameter (ParameterSetName = ' longterm' , Mandatory )]
95+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
96+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ITimeSeriesIdProperty []]
97+ # The list of event properties which will be used to define the environment's time series id.
98+ ${TimeSeriesIdProperty} ,
99+
100+ [Parameter (ParameterSetName = ' longterm' , Mandatory )]
101+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
102+ [System.String ]
103+ # The name of the storage account that will hold the environment's long term data.
104+ ${StorageAccountName} ,
105+
106+ [Parameter (ParameterSetName = ' longterm' , Mandatory )]
107+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
108+ [System.Security.SecureString ]
109+ # The value of the management key that grants the Time Series Insights service write access to the storage account.
110+ ${StorageAccountKey} ,
111+
112+ [Parameter (ParameterSetName = ' longterm' )]
113+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
114+ [System.TimeSpan ]
115+ # ISO8601 timespan specifying the number of days the environment's events will be available for query from the warm store.
116+ ${WarmStoreDataRetentionTime} ,
117+
118+ [Parameter ()]
119+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Body' )]
120+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.Info (PossibleTypes= ([Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.ICreateOrUpdateTrackedResourcePropertiesTags ]))]
121+ [System.Collections.Hashtable ]
122+ # Key-value pairs of additional properties for the resource.
123+ ${Tag} ,
124+
125+ [Parameter ()]
126+ [Alias (' AzureRMContext' , ' AzureCredential' )]
127+ [ValidateNotNull ()]
128+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Azure' )]
129+ [System.Management.Automation.PSObject ]
130+ # The credentials, account, tenant, and subscription used for communication with Azure.
131+ ${DefaultProfile} ,
132+
133+ [Parameter ()]
134+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
135+ [System.Management.Automation.SwitchParameter ]
136+ # Run the command as a job
137+ ${AsJob} ,
138+
139+ [Parameter (DontShow)]
140+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
141+ [System.Management.Automation.SwitchParameter ]
142+ # Wait for .NET debugger to attach
143+ ${Break} ,
144+
145+ [Parameter (DontShow)]
146+ [ValidateNotNull ()]
147+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
148+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep []]
149+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
150+ ${HttpPipelineAppend} ,
151+
152+ [Parameter (DontShow)]
153+ [ValidateNotNull ()]
154+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
155+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Runtime.SendAsyncStep []]
156+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
157+ ${HttpPipelinePrepend} ,
158+
159+ [Parameter ()]
160+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
161+ [System.Management.Automation.SwitchParameter ]
162+ # Run the command asynchronously
163+ ${NoWait} ,
164+
165+ [Parameter (DontShow)]
166+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
167+ [System.Uri ]
168+ # The URI for the proxy server to use
169+ ${Proxy} ,
170+
171+ [Parameter (DontShow)]
172+ [ValidateNotNull ()]
173+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
174+ [System.Management.Automation.PSCredential ]
175+ # Credentials for a proxy server to use for the remote call
176+ ${ProxyCredential} ,
177+
178+ [Parameter (DontShow)]
179+ [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Category (' Runtime' )]
180+ [System.Management.Automation.SwitchParameter ]
181+ # Use the default credentials for the proxy
182+ ${ProxyUseDefaultCredentials}
183+ )
184+
185+
186+
187+ process {
188+ try {
189+ if ($PSBoundParameters [' Kind' ] -eq ' Standard' ) {
190+ $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.StandardEnvironmentCreateOrUpdateParameters ]::new()
191+ $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.StandardEnvironmentCreationProperties ]::new()
192+
193+ $Parameter.SkuCapacity = $PSBoundParameters [' Capacity' ]
194+ $null = $PSBoundParameters.Remove (' Capacity' )
195+
196+ $Parameter.Property.DataRetentionTime = $PSBoundParameters [' DataRetentionTime' ]
197+ $null = $PSBoundParameters.Remove (' DataRetentionTime' )
198+
199+ if ($PSBoundParameters.ContainsKey (' PartitionKeyProperty' )) {
200+ $Parameter.Property.PartitionKeyProperty = $PSBoundParameters [' PartitionKeyProperty' ]
201+ $null = $PSBoundParameters.Remove (' PartitionKeyProperty' )
202+ }
203+
204+ if ($PSBoundParameters.ContainsKey (' StorageLimitExceededBehavior' )) {
205+ $Parameter.Property.StorageLimitExceededBehavior = $PSBoundParameters [' StorageLimitExceededBehavior' ]
206+ $null = $PSBoundParameters.Remove (' StorageLimitExceededBehavior' )
207+ }
208+ } else {
209+ $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.LongTermEnvironmentCreateOrUpdateParameters ]::new()
210+ $Parameter.Property = [Microsoft.Azure.PowerShell.Cmdlets.TimeSeriesInsights.Models.Api20180815Preview.LongTermEnvironmentCreationProperties ]::new()
211+
212+ $Parameter.Property.StorageConfigurationAccountName = $PSBoundParameters [' StorageAccountName' ]
213+ $null = $PSBoundParameters.Remove (' StorageAccountName' )
214+
215+ $Parameter.Property.StorageConfigurationManagementKey = [System.Runtime.InteropServices.marshal ]::PtrToStringAuto([System.Runtime.InteropServices.marshal ]::SecureStringToBSTR($PSBoundParameters [' StorageAccountKey' ]))
216+ $null = $PSBoundParameters.Remove (' StorageAccountKey' )
217+
218+ $Parameter.Property.TimeSeriesIdProperty = $PSBoundParameters [' TimeSeriesIdProperty' ]
219+ $null = $PSBoundParameters.Remove (' TimeSeriesIdProperty' )
220+
221+ # For L1, SkuCapacity is 1, which is a service side behavior
222+ $Parameter.SkuCapacity = 1
223+
224+ if ($PSBoundParameters.ContainsKey (' WarmStoreDataRetentionTime' )) {
225+ $Parameter.Property.WarmStoreConfigurationDataRetention = $PSBoundParameters [' WarmStoreDataRetentionTime' ]
226+ $null = $PSBoundParameters.Remove (' WarmStoreDataRetentionTime' )
227+ }
228+ }
229+ $Parameter.Kind = $PSBoundParameters [' Kind' ]
230+ $null = $PSBoundParameters.Remove (' Kind' )
231+
232+ $Parameter.Location = $PSBoundParameters [' Location' ]
233+ $null = $PSBoundParameters.Remove (' Location' )
234+
235+ $Parameter.SkuName = $PSBoundParameters [' Sku' ]
236+ $null = $PSBoundParameters.Remove (' Sku' )
237+
238+ if ($PSBoundParameters.ContainsKey (' Tag' )) {
239+ $Parameter.Tag = $PSBoundParameters [' Tag' ]
240+ $null = $PSBoundParameters.Remove (' Tag' )
241+ }
242+
243+ $null = $PSBoundParameters.Add (' Parameter' , $Parameter )
244+
245+ Az.TimeSeriesInsights.internal\New-AzTimeSeriesInsightsEnvironment @PSBoundParameters
246+ } catch {
247+ throw
248+ }
249+ }
250+ }
251+
0 commit comments