private void EnsureSubdomainAvailabilityOrThrow() { var checkSubdomainInputs = new OperationInputs(this.Subdomain, resourceType); var subdomainAvailabilityInfo = this.IotCentralClient.Apps.CheckSubdomainAvailability(checkSubdomainInputs); IotCentralUtils.EnsureAvailabilityOrThrow(subdomainAvailabilityInfo); }
public override void ExecuteCmdlet() { if (ShouldProcess(Name, ResourceProperties.Resources.NewIotCentralApp)) { this.EnsureNameAvailabilityOrThrow(); this.EnsureSubdomainAvailabilityOrThrow(); var iotCentralApp = new App() { DisplayName = this.GetDisplayName(), Subdomain = this.Subdomain, Template = this.Template, Sku = new AppSkuInfo() { Name = this.GetAppSkuName() }, Location = this.GetLocation(), Tags = this.GetTags() }; this.IotCentralClient.Apps.CreateOrUpdate(this.ResourceGroupName, this.Name, iotCentralApp); App createdIotCentralApp = this.IotCentralClient.Apps.Get(this.ResourceGroupName, this.Name); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(createdIotCentralApp), false); } }
private void EnsureNameAvailabilityOrThrow() { var checkNameInputs = new OperationInputs(this.Name, resourceType); var nameAvailabilityInfo = this.IotCentralClient.Apps.CheckNameAvailability(checkNameInputs); IotCentralUtils.EnsureAvailabilityOrThrow(nameAvailabilityInfo); }
public override void ExecuteCmdlet() { if (ShouldProcess(Name, ResourceProperties.Resources.NewIotCentralApp)) { var inputs = new OperationInputs(this.Name, "IotApps"); var availabilityInfo = this.IotCentralClient.Apps.CheckNameAvailability(inputs); if (!(availabilityInfo.NameAvailable == true)) { throw new PSArgumentException(availabilityInfo.Message); } var iotCentralApp = new App() { DisplayName = this.GetDisplayName(), Subdomain = this.Subdomain, Template = this.Template, Sku = new AppSkuInfo() { Name = this.GetAppSkuName() }, Location = this.GetLocation(), Tags = this.GetTags() }; this.IotCentralClient.Apps.CreateOrUpdate(this.ResourceGroupName, this.Name, iotCentralApp); App createdIotCentralApp = this.IotCentralClient.Apps.Get(this.ResourceGroupName, this.Name); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(createdIotCentralApp), false); } }
public override void ExecuteCmdlet() { switch (ParameterSetName) { case InteractiveIotCentralParameterSet: App iotCentralApp = this.IotCentralClient.Apps.Get(this.ResourceGroupName, this.Name); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(iotCentralApp)); break; case ListIotCentralAppsParameterSet: if (string.IsNullOrEmpty(this.ResourceGroupName)) { IEnumerable <App> iotCentralAppsBySubscription = this.IotCentralClient.Apps.ListBySubscription(); this.WriteObject(IotCentralUtils.ToPSIotCentralApps(iotCentralAppsBySubscription), enumerateCollection: true); break; } else { IEnumerable <App> iotCentralAppsByResourceGroup = this.IotCentralClient.Apps.ListByResourceGroup(this.ResourceGroupName); this.WriteObject(IotCentralUtils.ToPSIotCentralApps(iotCentralAppsByResourceGroup), enumerateCollection: true); break; } case ResourceIdParameterSet: ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId); var app = this.IotCentralClient.Apps.Get(identifier.ResourceGroupName, identifier.ResourceName); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(app)); break; default: throw new PSArgumentException("BadParameterSetName"); } }
public override void ExecuteCmdlet() { this.SetNameAndResourceGroup(); if (ShouldProcess(Name, ResourceProperties.Resources.SetIotCentralApp)) { AppPatch applicationPatch = CreateApplicationPatch(); App updatedIotCentralApplication = this.IotCentralClient.Apps.Update(this.ResourceGroupName, this.Name, applicationPatch); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(updatedIotCentralApplication)); } }
private AppPatch CreateApplicationPatch() { App existingIotCentralApplication = this.GetApplication(); this.SetApplicationDisplayName(existingIotCentralApplication); this.SetApplicationTags(existingIotCentralApplication); AppPatch iotCentralAppPatch = IotCentralUtils.CreateAppPatch(existingIotCentralApplication); return(iotCentralAppPatch); }
public override void ExecuteCmdlet() { if (ShouldProcess(Name, ResourceProperties.Resources.NewIotCentralApp)) { var iotCentralApp = new App() { DisplayName = this.GetDisplayName(), Subdomain = this.Subdomain, Template = this.Template, Sku = new AppSkuInfo() { Name = this.GetAppSkuName() }, Location = this.GetLocation(), Tags = this.GetTags(), Identity = new SystemAssignedServiceIdentity(this.GetIdentity()), }; this.IotCentralClient.Apps.CreateOrUpdate(this.ResourceGroupName, this.Name, iotCentralApp); App createdIotCentralApp = this.IotCentralClient.Apps.Get(this.ResourceGroupName, this.Name); this.WriteObject(IotCentralUtils.ToPSIotCentralApp(createdIotCentralApp), false); } }