/// <summary> /// Executes the get integration account agreement command. /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (string.IsNullOrEmpty(this.AgreementName)) { this.WriteObject(IntegrationAccountClient.ListIntegrationAccountAgreements(this.ResourceGroupName, this.Name), true); } else { this.WriteObject(IntegrationAccountClient.GetIntegrationAccountAgreement(this.ResourceGroupName, this.Name, this.AgreementName), true); } }
/// <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); }