public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.ClusterName = resourceIdentifier.ResourceName; } PSClusterPatch parameters = new PSClusterPatch(); if (this.IsParameterBound(c => c.InputCluster)) { parameters.KeyVaultProperties = InputCluster.KeyVaultProperties; parameters.Sku = InputCluster.Sku; parameters.Tags = InputCluster.Tags; parameters.Identity = InputCluster.Identity; parameters.BillingType = InputCluster.BillingType; } else { parameters.KeyVaultProperties = PSKeyVaultProperties.CreateProperties(this.KeyVaultUri, this.KeyName, this.KeyVersion); parameters.Sku = this.SkuCapacity == null ? null : new PSClusterSku(this.SkuName ?? AllowedClusterServiceTiers.CapacityReservation.ToString(), this.SkuCapacity); parameters.Tags = this.Tag; parameters.Identity = new PSIdentity(IdentityType); parameters.BillingType = BillingType; } if (ShouldProcess(this.ClusterName, $"update cluster: {this.ClusterName} in resource group: {this.ResourceGroupName}")) { WriteObject(this.OperationalInsightsClient.UpdatePSCluster(this.ResourceGroupName, this.ClusterName, parameters)); } }
public override void ExecuteCmdlet() { PSCluster parameters = new PSCluster() { Name = this.ClusterName, Location = this.Location, Identity = new PSIdentity(this.IdentityType), Sku = new PSClusterSku(this.SkuName ?? AllowedClusterServiceTiers.CapacityReservation.ToString(), this.SkuCapacity), Tags = this.Tag, IsDoubleEncryptionEnabled = this.IsDoubleEncryptionEnabled, IsAvailabilityZonesEnabled = this.IsAvailabilityZonesEnabled, BillingType = this.BillingType, KeyVaultProperties = PSKeyVaultProperties.CreateProperties(this.KeyVaultUri, this.KeyName, this.KeyVersion), }; if (ShouldProcess(this.ClusterName, string.Format("create cluster: {0} in resource group: {1}", this.ClusterName, this.ResourceGroupName))) { WriteObject(this.OperationalInsightsClient.CreatePSCluster(this.ResourceGroupName, this.ClusterName, parameters)); } }