Beispiel #1
0
        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);
            }
        }
        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");
            }
        }
Beispiel #4
0
 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));
     }
 }
        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);
            }
        }