private void CreateAfdCustomDomain() { try { AFDDomain afdCustomDomain = new AFDDomain { HostName = this.HostName, }; if (MyInvocation.BoundParameters.ContainsKey("AzureDnsZoneId")) { afdCustomDomain.AzureDnsZone = new ResourceReference(this.AzureDnsZoneId); } if (ParameterSetName == AfdParameterSet.AfdCustomDomainCustomerCertificate) { afdCustomDomain.TlsSettings = new AFDDomainHttpsParameters { CertificateType = "CustomerCertificate", MinimumTlsVersion = AfdUtilities.CreateMinimumTlsVersion(this.MinimumTlsVersion), Secret = new ResourceReference(this.SecretId) }; } PSAfdCustomDomain psAfdCustomDomain = this.CdnManagementClient.AFDCustomDomains.Create(this.ResourceGroupName, this.ProfileName, this.CustomDomainName, afdCustomDomain).ToPSAfdCustomDomain(); WriteObject(psAfdCustomDomain); } catch (AfdErrorResponseException errorResponse) { throw new PSArgumentException(errorResponse.Response.Content); } }
private void ResourceIdParameterSetCmdlet() { ResourceIdentifier parsedAfdCustomDomainResourceId = new ResourceIdentifier(this.ResourceId); this.CustomDomainName = parsedAfdCustomDomainResourceId.ResourceName; this.ProfileName = parsedAfdCustomDomainResourceId.GetResourceName("profiles"); this.ResourceGroupName = parsedAfdCustomDomainResourceId.ResourceGroupName; PSAfdCustomDomain psAfdCustomDomain = this.CdnManagementClient.AFDCustomDomains.Get(this.ResourceGroupName, this.ProfileName, this.CustomDomainName).ToPSAfdCustomDomain(); WriteObject(psAfdCustomDomain); }
private void CreateAfdCustomDomain() { try { AFDDomain afdCustomDomain = new AFDDomain { HostName = this.HostName }; PSAfdCustomDomain psAfdCustomDomain = this.CdnManagementClient.AFDCustomDomains.Create(this.ResourceGroupName, this.ProfileName, this.CustomDomainName, afdCustomDomain).ToPSAfdCustomDomain(); WriteObject(psAfdCustomDomain); } catch (AfdErrorResponseException errorResponse) { throw new PSArgumentException(errorResponse.Response.Content); } }
private void FieldsParameterSetCmdlet() { if (AfdUtilities.IsValuePresent(this.CustomDomainName)) { // all fields are present (mandatory + optional) PSAfdCustomDomain psAfdCustomDomain = this.CdnManagementClient.AFDCustomDomains.Get(this.ResourceGroupName, this.ProfileName, this.CustomDomainName).ToPSAfdCustomDomain(); WriteObject(psAfdCustomDomain); } else { // only the mandatory fields are present List <PSAfdCustomDomain> psAfdCustomDomains = this.CdnManagementClient.AFDCustomDomains.ListByProfile(this.ResourceGroupName, this.ProfileName) .Select(afdCustomDomain => afdCustomDomain.ToPSAfdCustomDomain()) .ToList(); WriteObject(psAfdCustomDomains); } }