/// <summary> /// Executes the integration account map create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); if (string.IsNullOrEmpty(this.MapDefinition)) { this.MapDefinition = CmdletHelper.GetContentFromFile(this.TryResolvePath(this.MapFilePath)); } this.ContentType = this.MapType.Equals("liquid", StringComparison.CurrentCultureIgnoreCase) ? "text/plain" : "application/xml"; this.WriteObject(IntegrationAccountClient.CreateIntegrationAccountMap(this.ResourceGroupName, integrationAccount.Name, this.MapName, new IntegrationAccountMap { ContentType = this.ContentType, Content = this.MapDefinition, MapType = this.MapType, Metadata = this.Metadata }), true); }
/// <summary> /// Executes the integration account map create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); if (string.IsNullOrEmpty(this.MapDefinition)) { this.MapDefinition = CmdletHelper.GetContentFromFile(this.TryResolvePath(this.MapFilePath)); } this.WriteObject(IntegrationAccountClient.CreateIntegrationAccountMap(this.ResourceGroupName, integrationAccount.Name, this.MapName, new IntegrationAccountMap { ContentType = this.ContentType, Content = this.MapDefinition, MapType = this.MapType, Metadata = this.Metadata }), true); }
/// <summary> /// Executes the integration account schema create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); if (string.IsNullOrEmpty(this.SchemaDefinition)) { this.SchemaDefinition = CmdletHelper.GetContentFromFile(this.TryResolvePath(this.SchemaFilePath)); } this.WriteObject( IntegrationAccountClient.CreateIntegrationAccountSchema(this.ResourceGroupName, integrationAccount.Name, this.SchemaName, new IntegrationAccountSchema { ContentType = this.contentType, SchemaType = (SchemaType)Enum.Parse(typeof(SchemaType), this.schemaType), Content = this.SchemaDefinition, Metadata = this.Metadata }), true); }
/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Definition != null) { this.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { this.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (this.Parameters != null) { this.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { this.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } this.WriteObject(LogicAppClient.CreateWorkflow(this.ResourceGroupName, this.Name, new Workflow { Location = this.Location, Definition = this.Definition, Parameters = this.Parameters as Dictionary <string, WorkflowParameter>, IntegrationAccount = string.IsNullOrEmpty(this.IntegrationAccountId) ? null : new ResourceReference(this.IntegrationAccountId), State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State) }), true); }
/// <summary> /// Executes the integration account partner create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); this.WriteObject( IntegrationAccountClient.CreateIntegrationAccountPartner(this.ResourceGroupName, integrationAccount.Name, this.PartnerName, new IntegrationAccountPartner { PartnerType = (PartnerType)Enum.Parse(typeof(PartnerType), this.PartnerType), Content = new PartnerContent { B2b = new B2BPartnerContent { BusinessIdentities = CmdletHelper.ConvertToBusinessIdentityList(BusinessIdentities) } }, Metadata = this.Metadata }), true); }
/// <summary> /// Executes the integration account agreement create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var hostPartner = IntegrationAccountClient.GetIntegrationAccountPartner(this.ResourceGroupName, this.Name, this.HostPartner); var guestPartner = IntegrationAccountClient.GetIntegrationAccountPartner(this.ResourceGroupName, this.Name, this.GuestPartner); var hostIdentity = hostPartner.Content.B2b.BusinessIdentities.FirstOrDefault( s => s.Qualifier == this.HostIdentityQualifier && s.Value == this.HostIdentityQualifierValue); if (hostIdentity == null) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.InvalidQualifierSpecified, this.HostIdentityQualifier, this.HostPartner)); } var guestIdentity = guestPartner.Content.B2b.BusinessIdentities.FirstOrDefault( s => s.Qualifier == this.GuestIdentityQualifier && s.Value == this.GuestIdentityQualifierValue); if (guestIdentity == null) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.InvalidQualifierSpecified, this.GuestIdentityQualifier, this.GuestPartner)); } if (string.IsNullOrEmpty(this.AgreementContent)) { this.AgreementContent = CmdletHelper.GetStringContentFromFile(this.TryResolvePath(this.AgreementContentFilePath)); } this.WriteObject( IntegrationAccountClient.CreateIntegrationAccountAgreement(this.ResourceGroupName, integrationAccount.Name, this.AgreementName, new IntegrationAccountAgreement { AgreementType = (AgreementType)Enum.Parse(typeof(AgreementType), this.AgreementType), HostIdentity = hostIdentity, GuestIdentity = guestIdentity, GuestPartner = this.GuestPartner, HostPartner = this.HostPartner, Content = CmdletHelper.ConvertToAgreementContent(this.AgreementContent), Metadata = this.Metadata }), true); }
/// <summary> /// Executes the integration account map update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var integrationAccountMap = IntegrationAccountClient.GetIntegrationAccountMap(this.ResourceGroupName, this.Name, this.MapName); if (!string.IsNullOrEmpty(this.MapFilePath)) { integrationAccountMap.Content = CmdletHelper.GetContentFromFile(this.TryResolvePath(this.MapFilePath)); } if (!string.IsNullOrEmpty(this.MapDefinition)) { integrationAccountMap.Content = this.MapDefinition; CmdletHelper.GetContentFromFile(this.TryResolvePath(this.MapFilePath)); } if (!string.IsNullOrEmpty(this.ContentType)) { integrationAccountMap.ContentType = this.contentType; } if (!string.IsNullOrEmpty(this.MapType)) { integrationAccountMap.MapType = (MapType)Enum.Parse(typeof(MapType), this.MapType); } if (this.Metadata != null) { integrationAccountMap.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/maps", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/maps", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountMap(this.ResourceGroupName, this.Name, this.MapName, integrationAccountMap), true); }, null); }
/// <summary> /// Executes the integration account certificate create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Metadata != null) { this.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } string certificate = null; var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); if (!string.IsNullOrEmpty(this.PublicCertificateFilePath)) { var certificateFilePath = this.TryResolvePath(this.PublicCertificateFilePath); if (!string.IsNullOrEmpty(certificateFilePath) && CmdletHelper.FileExists(certificateFilePath)) { var cert = new X509Certificate2(certificateFilePath); certificate = Convert.ToBase64String(cert.RawData); } } KeyVaultKeyReference keyref = null; if (!string.IsNullOrEmpty(this.KeyName) && !string.IsNullOrEmpty(this.KeyVersion) && !string.IsNullOrEmpty(this.KeyVaultId)) { keyref = new KeyVaultKeyReference { KeyName = this.KeyName, KeyVersion = this.KeyVersion, KeyVault = new KeyVaultKeyReferenceKeyVault() { Id = this.KeyVaultId } }; } this.WriteObject( IntegrationAccountClient.CreateIntegrationAccountCertificate(this.ResourceGroupName, integrationAccount.Name, this.CertificateName, new IntegrationAccountCertificate { Key = keyref, Metadata = this.Metadata, PublicCertificate = certificate } ), true); }
/// <summary> /// Executes the integration account partner update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var integrationAccountPartner = IntegrationAccountClient.GetIntegrationAccountPartner( this.ResourceGroupName, this.Name, this.PartnerName); if (!string.IsNullOrEmpty(this.PartnerType)) { integrationAccountPartner.PartnerType = (PartnerType)Enum.Parse(typeof(PartnerType), this.PartnerType); } if (this.BusinessIdentities != null) { integrationAccountPartner.Content.B2b.BusinessIdentities = CmdletHelper.ConvertToBusinessIdentityList(this.BusinessIdentities); } if (this.Metadata != null) { integrationAccountPartner.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/partners", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/partners", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountPartner(this.ResourceGroupName, integrationAccount.Name, this.PartnerName, integrationAccountPartner), true); }, null); }
/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var workflow = LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name); if (this.Definition == null) { workflow.Definition = null; } else if (this.Definition.ToString() != string.Empty) { workflow.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { workflow.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (!string.IsNullOrEmpty(this.IntegrationAccountId)) { workflow.IntegrationAccount = new ResourceReference(this.IntegrationAccountId); } if (this.Parameters == null) { workflow.Parameters = null; } else if (this.Parameters.ToString() != string.Empty) { workflow.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { workflow.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } if (!string.IsNullOrEmpty(this.State)) { workflow.State = this.State; } if (UseConsumptionModel.IsPresent) { workflow.Sku = null; } else if (!string.IsNullOrEmpty(this.AppServicePlan)) { var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan); workflow.Sku = new Sku { Name = servicePlan.Sku.Tier, Plan = new ResourceReference(id: servicePlan.Id) }; } if (workflow.Definition == null) { throw new PSArgumentException(Properties.Resource.DefinitionMissingWarning); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/workflows", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/workflows", this.Name), Name, () => { this.WriteObject(LogicAppClient.UpdateWorkflow(this.ResourceGroupName, this.Name, workflow), true); }, null); }
/// <summary> /// Executes the integration account map update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var integrationAccountMap = IntegrationAccountClient.GetIntegrationAccountMap(this.ResourceGroupName, this.Name, this.MapName); var integrationAccountMapCopy = new IntegrationAccountMap(mapType: integrationAccountMap.MapType, id: integrationAccountMap.Id, name: integrationAccountMap.Name, type: integrationAccountMap.Type, location: integrationAccountMap.Location, tags: integrationAccountMap.Tags, parametersSchema: integrationAccountMap.ParametersSchema, createdTime: integrationAccountMap.CreatedTime, changedTime: integrationAccountMap.ChangedTime, content: integrationAccountMap.Content, contentLink: null, metadata: integrationAccountMap.Metadata); if (!string.IsNullOrEmpty(this.MapFilePath)) { integrationAccountMapCopy.Content = CmdletHelper.GetStringContentFromFile(this.TryResolvePath(this.MapFilePath)); } if (!string.IsNullOrEmpty(this.MapDefinition)) { integrationAccountMapCopy.Content = this.MapDefinition; CmdletHelper.GetStringContentFromFile(this.TryResolvePath(this.MapFilePath)); } if (!string.IsNullOrEmpty(this.MapType)) { integrationAccountMapCopy.MapType = this.MapType; } integrationAccountMapCopy.ContentType = this.MapType.Equals("liquid", StringComparison.CurrentCultureIgnoreCase) ? "text/plain" : "application/xml"; if (this.Metadata != null) { integrationAccountMapCopy.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/maps", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/maps", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountMap(this.ResourceGroupName, this.Name, this.MapName, integrationAccountMapCopy), true); }, null); }
/// <summary> /// Executes the integration account certificate update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var integrationAccountCertificate = IntegrationAccountClient.GetIntegrationAccountCertifcate(this.ResourceGroupName, this.Name, this.CertificateName); if (!string.IsNullOrEmpty(this.KeyName)) { integrationAccountCertificate.Key.KeyName = this.KeyName; } if (!string.IsNullOrEmpty(this.KeyVersion)) { integrationAccountCertificate.Key.KeyVersion = this.KeyVersion; } if (!string.IsNullOrEmpty(this.KeyVaultId)) { integrationAccountCertificate.Key.KeyVault.Id = this.KeyVaultId; } string certificate = null; if (!string.IsNullOrEmpty(this.PublicCertificateFilePath)) { var certificateFilePath = this.TryResolvePath(this.PublicCertificateFilePath); if (!string.IsNullOrEmpty(certificateFilePath) && CmdletHelper.FileExists(certificateFilePath)) { var cert = new X509Certificate2(certificateFilePath); certificate = Convert.ToBase64String(cert.RawData); } } if (!string.IsNullOrEmpty(certificate)) { integrationAccountCertificate.PublicCertificate = certificate; } if (this.Metadata != null) { integrationAccountCertificate.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/certificates", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/certificates", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountCertificate(this.ResourceGroupName, integrationAccount.Name, this.CertificateName, integrationAccountCertificate), true); }, null); }
/// <summary> /// Executes the integration account schema create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccount = IntegrationAccountClient.GetIntegrationAccount(this.ResourceGroupName, this.Name); var integrationAccountSchema = IntegrationAccountClient.GetIntegrationAccountSchema(this.ResourceGroupName, this.Name, this.SchemaName); var integrationAccountSchemaCopy = new IntegrationAccountSchema(schemaType: integrationAccountSchema.SchemaType, id: integrationAccountSchema.Id, name: integrationAccountSchema.Name, type: integrationAccountSchema.Type, location: integrationAccountSchema.Location, tags: integrationAccountSchema.Tags, targetNamespace: integrationAccountSchema.TargetNamespace, documentName: integrationAccountSchema.DocumentName, fileName: integrationAccountSchema.FileName, createdTime: integrationAccountSchema.CreatedTime, changedTime: integrationAccountSchema.ChangedTime, metadata: integrationAccountSchema.Metadata, content: integrationAccountSchema.Content, contentType: integrationAccountSchema.ContentType, contentLink: null); if (!string.IsNullOrEmpty(this.SchemaFilePath)) { integrationAccountSchemaCopy.Content = CmdletHelper.GetContentFromFile(this.TryResolvePath(this.SchemaFilePath)); } if (!string.IsNullOrEmpty(this.SchemaDefinition)) { integrationAccountSchemaCopy.Content = this.SchemaDefinition; } if (!string.IsNullOrEmpty(this.schemaType)) { integrationAccountSchemaCopy.SchemaType = (SchemaType)Enum.Parse(typeof(SchemaType), this.SchemaType); } if (!string.IsNullOrEmpty(this.ContentType)) { integrationAccountSchemaCopy.ContentType = this.ContentType; } if (this.Metadata != null) { integrationAccountSchemaCopy.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/schemas", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/schemas", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountSchema(this.ResourceGroupName, integrationAccount.Name, this.SchemaName, integrationAccountSchemaCopy), true); }, null); }
/// <summary> /// Executes the integration account assembly create command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); switch (this.ParameterSetName) { case ParameterSet.ByInputObjectAndContentLink: case ParameterSet.ByInputObjectAndFileBytes: case ParameterSet.ByInputObjectAndFilePath: { var parsedResourceId = new ResourceIdentifier(this.ParentObject.Id); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.ParentName = parsedResourceId.ResourceName; break; } case ParameterSet.ByResourceIdAndContentLink: case ParameterSet.ByResourceIdAndFileBytes: case ParameterSet.ByResourceIdAndFilePath: { var parsedResourceId = new ResourceIdentifier(this.ParentResourceId); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.ParentName = parsedResourceId.ParentResource.Split('/')[1]; break; } } var assemblyDefinition = new AssemblyDefinition { Properties = new AssemblyProperties { AssemblyName = this.Name, ContentType = "application/octet-stream", Metadata = this.Metadata } }; switch (this.ParameterSetName) { case ParameterSet.ByInputObjectAndContentLink: case ParameterSet.ByResourceIdAndContentLink: case ParameterSet.ByIntegrationAccountAndContentLink: { assemblyDefinition.Properties.ContentLink = new ContentLink { Uri = this.ContentLink }; assemblyDefinition.Properties.Content = null; break; } case ParameterSet.ByInputObjectAndFileBytes: case ParameterSet.ByResourceIdAndFileBytes: case ParameterSet.ByIntegrationAccountAndFileBytes: { assemblyDefinition.Properties.Content = this.AssemblyData; assemblyDefinition.Properties.ContentLink = null; break; } case ParameterSet.ByInputObjectAndFilePath: case ParameterSet.ByResourceIdAndFilePath: case ParameterSet.ByIntegrationAccountAndFilePath: { assemblyDefinition.Properties.Content = CmdletHelper.GetBinaryContentFromFile(this.TryResolvePath(this.AssemblyFilePath)); assemblyDefinition.Properties.ContentLink = null; break; } } if (this.ShouldProcess(this.Name, string.Format(CultureInfo.InvariantCulture, Resource.CreateIntegrationAccountArtifactMessage, Resource.Assembly, this.Name, this.ResourceGroupName))) { this.WriteObject(IntegrationAccountClient.CreateIntegrationAccountAssembly(this.ResourceGroupName, this.ParentName, this.Name, assemblyDefinition)); } }
/// <summary> /// Executes the integration account agreement update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var integrationAccountAgreement = IntegrationAccountClient.GetIntegrationAccountAgreement(this.ResourceGroupName, this.Name, this.AgreementName); if (this.Metadata != null) { integrationAccountAgreement.Metadata = CmdletHelper.ConvertToMetadataJObject(this.Metadata); } var hostPartner = IntegrationAccountClient.GetIntegrationAccountPartner(this.ResourceGroupName, this.Name, string.IsNullOrEmpty(this.HostPartner) ? integrationAccountAgreement.HostPartner : this.HostPartner); integrationAccountAgreement.HostPartner = hostPartner.Name; var guestPartner = IntegrationAccountClient.GetIntegrationAccountPartner(this.ResourceGroupName, this.Name, string.IsNullOrEmpty(this.GuestPartner) ? integrationAccountAgreement.GuestPartner : this.GuestPartner); integrationAccountAgreement.GuestPartner = guestPartner.Name; if (!string.IsNullOrEmpty(this.HostIdentityQualifier) && !string.IsNullOrEmpty(this.HostIdentityQualifierValue)) { var hostIdentity = hostPartner.Content.B2b.BusinessIdentities.FirstOrDefault( s => (s.Qualifier == this.HostIdentityQualifier && s.Value == this.HostIdentityQualifierValue)); if (hostIdentity == null) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.InvalidQualifierSpecified, this.HostIdentityQualifier, hostPartner.Name)); } integrationAccountAgreement.HostIdentity = hostIdentity; } else if (string.IsNullOrEmpty(this.HostIdentityQualifier) ^ string.IsNullOrEmpty(this.HostIdentityQualifierValue)) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.QualifierWithValueNotSpecified, "Host")); } if (!string.IsNullOrEmpty(this.GuestIdentityQualifier) && !string.IsNullOrEmpty(this.GuestIdentityQualifierValue)) { var guestIdentity = guestPartner.Content.B2b.BusinessIdentities.FirstOrDefault( s => (s.Qualifier == this.GuestIdentityQualifier && s.Value == this.GuestIdentityQualifierValue)); if (guestIdentity == null) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.InvalidQualifierSpecified, this.GuestIdentityQualifier, guestPartner.Name)); } integrationAccountAgreement.GuestIdentity = guestIdentity; } else if (string.IsNullOrEmpty(this.GuestIdentityQualifier) ^ string.IsNullOrEmpty(this.GuestIdentityQualifierValue)) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Properties.Resource.QualifierWithValueNotSpecified, "Guest")); } if (!string.IsNullOrEmpty(this.AgreementType)) { integrationAccountAgreement.AgreementType = (AgreementType)Enum.Parse(typeof(AgreementType), this.AgreementType); } if (!string.IsNullOrEmpty(this.AgreementContentFilePath)) { this.AgreementContent = CmdletHelper.GetStringContentFromFile(this.TryResolvePath(this.AgreementContentFilePath)); } if (!string.IsNullOrEmpty(this.AgreementContent)) { integrationAccountAgreement.Content = CmdletHelper.ConvertToAgreementContent(this.AgreementContent); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/integrationAccounts/agreements", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/integrationAccounts/agreements", this.Name), Name, () => { this.WriteObject( IntegrationAccountClient.UpdateIntegrationAccountAgreement(this.ResourceGroupName, this.Name, this.AgreementName, integrationAccountAgreement), true); }, null); }
/// <summary> /// Executes the integration account batch configuration update command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); switch (this.ParameterSetName) { case ParameterSet.ByInputObjectAndJson: case ParameterSet.ByInputObjectAndFilePath: case ParameterSet.ByInputObjectAndParameters: { var parsedResourceId = new ResourceIdentifier(this.InputObject.Id); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.ParentName = parsedResourceId.ResourceName; break; } case ParameterSet.ByResourceIdAndJson: case ParameterSet.ByResourceIdAndFilePath: case ParameterSet.ByResourceIdAndParameters: { var parsedResourceId = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = parsedResourceId.ResourceGroupName; this.ParentName = parsedResourceId.ResourceName; break; } } var batchConfiguration = new BatchConfiguration(); switch (this.ParameterSetName) { case ParameterSet.ByInputObjectAndJson: case ParameterSet.ByResourceIdAndJson: case ParameterSet.ByIntegrationAccountAndJson: { batchConfiguration.Properties = CmdletHelper.ConvertToBatchConfigurationProperties(this.BatchConfigurationDefinition); break; } case ParameterSet.ByInputObjectAndFilePath: case ParameterSet.ByResourceIdAndFilePath: case ParameterSet.ByIntegrationAccountAndFilePath: { batchConfiguration.Properties = CmdletHelper.ConvertToBatchConfigurationProperties(CmdletHelper.GetStringContentFromFile(this.TryResolvePath(this.BatchConfigurationFilePath))); break; } case ParameterSet.ByInputObjectAndParameters: case ParameterSet.ByResourceIdAndParameters: case ParameterSet.ByIntegrationAccountAndParameters: { var releaseCriteria = new BatchReleaseCriteria(); if (this.MyInvocation.BoundParameters.ContainsKey("MessageCount")) { releaseCriteria.MessageCount = this.MessageCount; } if (this.MyInvocation.BoundParameters.ContainsKey("BatchSize")) { releaseCriteria.BatchSize = this.BatchSize; } if (this.MyInvocation.BoundParameters.ContainsKey("ScheduleInterval")) { releaseCriteria.Recurrence = new WorkflowTriggerRecurrence { Interval = this.ScheduleInterval, Frequency = this.ScheduleFrequency, TimeZone = !string.IsNullOrWhiteSpace(this.ScheduleTimeZone) ? this.ScheduleTimeZone : null, StartTime = this.ScheduleStartTime?.ToShortDateString() }; } batchConfiguration.Properties = new BatchConfigurationProperties { BatchGroupName = this.BatchGroupName, ReleaseCriteria = releaseCriteria }; if (!this.IsValidReleaseCriteria(releaseCriteria)) { throw new PSArgumentException(string.Format(CultureInfo.InvariantCulture, Resource.BatchConfigurationParameterNeedsToBeSpecified)); } break; } } batchConfiguration.Properties.Metadata = this.Metadata; if (this.ShouldProcess(this.Name, string.Format(CultureInfo.InvariantCulture, Resource.UpdateIntegrationAccountArtifactMessage, Resource.BatchConfiguration, this.Name, this.ResourceGroupName))) { var updatedBatchConfiguration = IntegrationAccountClient.UpdateIntegrationAccountBatchConfiguration(this.ResourceGroupName, this.ParentName, this.Name, batchConfiguration); this.WriteObject(updatedBatchConfiguration); } }
/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (this.Definition != null) { this.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { this.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (this.Parameters != null) { this.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { this.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan); if (string.IsNullOrEmpty(this.Location)) { this.Location = servicePlan.GeoRegion; } this.WriteObject(LogicAppClient.CreateWorkflow(this.ResourceGroupName, this.Name, new Workflow { Location = this.Location, Definition = this.Definition, Parameters = this.Parameters as Dictionary <string, WorkflowParameter>, DefinitionLink = string.IsNullOrEmpty(this.DefinitionLinkUri) ? null : new ContentLink { Uri = this.DefinitionLinkUri, ContentVersion = this.DefinitionLinkContentVersion }, ParametersLink = string.IsNullOrEmpty(this.ParameterLinkUri) ? null : new ContentLink { Uri = this.ParameterLinkUri, ContentVersion = this.ParameterLinkContentVersion }, State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State), Sku = new Sku { Name = (SkuName)Enum.Parse(typeof(SkuName), servicePlan.Sku.Tier), Plan = new ResourceReference { Id = servicePlan.Id } } }), true); }
/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var workflow = LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name); if (this.Definition == null) { workflow.Definition = null; } else if (this.Definition.ToString() != string.Empty) { workflow.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { workflow.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (this.Parameters == null) { workflow.Parameters = null; } else if (this.Parameters.ToString() != string.Empty) { workflow.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { workflow.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } if (this.DefinitionLinkUri == null) { workflow.DefinitionLink = null; } else if (this.DefinitionLinkUri != string.Empty) { workflow.DefinitionLink = new ContentLink { Uri = this.DefinitionLinkUri, ContentVersion = this.DefinitionLinkContentVersion }; } if (this.ParameterLinkUri == null) { workflow.ParametersLink = null; } else if (this.ParameterLinkUri != string.Empty) { workflow.ParametersLink = new ContentLink { Uri = this.ParameterLinkUri, ContentVersion = this.ParameterLinkContentVersion }; } if (!string.IsNullOrEmpty(this.State)) { workflow.State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State); } if (!string.IsNullOrEmpty(this.AppServicePlan)) { var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan); workflow.Sku = new Sku { Name = (SkuName)Enum.Parse(typeof(SkuName), servicePlan.Sku.Tier), Plan = new ResourceReference { Id = servicePlan.Id } }; } if (workflow.DefinitionLink == null && workflow.Definition == null) { throw new PSArgumentException(Properties.Resource.DefinitionMissingWarning); } this.WriteObject(LogicAppClient.UpdateWorkflow(this.ResourceGroupName, this.Name, workflow), true); }