Skip to content

Commit

Permalink
Rename domain properties
Browse files Browse the repository at this point in the history
- Rename DomainConfiguration type and property to DomainName to match original resource name.
  • Loading branch information
danielrbradley committed Nov 27, 2023
1 parent e51205a commit 3d7688f
Show file tree
Hide file tree
Showing 11 changed files with 717 additions and 721 deletions.
18 changes: 9 additions & 9 deletions awsx/apigatewayv2/httpApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,25 +243,25 @@ export function buildHttpApi(parent: pulumi.Resource, name: string, args: schema
{ parent, dependsOn: [...routeResources, ...stageResources] },
);

function makeDomainMapping(domainName: string, domainMappingInput: schema.DomainMappingInputs) {
const { domainConfiguration, domainId, ...apiMappingArgs } = domainMappingInput;
function makeDomainMapping(domainKey: string, domainMappingInput: schema.DomainMappingInputs) {
const { domainName, domainId, ...apiMappingArgs } = domainMappingInput;
if (
(domainId === undefined && domainConfiguration === undefined) ||
(domainId !== undefined && domainConfiguration !== undefined)
(domainId === undefined && domainName === undefined) ||
(domainId !== undefined && domainName !== undefined)
) {
throw new Error(
`Exactly one of domainId or domainConfiguration must be specified for domain ${domainName}`,
`Exactly one of domainId or domainConfiguration must be specified for domain ${domainKey}`,
);
}
let resolvedDomainId = domainId;
const domainResourceName = domainName.replace(/\W+/g, "-");
const domainResourceName = domainKey.replace(/\W+/g, "-");
let domainResource: aws.apigatewayv2.DomainName | undefined;
if (domainConfiguration !== undefined) {
if (domainName !== undefined) {
domainResource = new aws.apigatewayv2.DomainName(
`${name}-${domainResourceName}`,
{
domainName: domainName,
...domainConfiguration,
domainName: domainKey,
...domainName,
},
{ parent },
);
Expand Down
24 changes: 12 additions & 12 deletions awsx/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,28 +388,28 @@ export interface TargetGroupAttachmentArgs {
readonly targetGroup?: pulumi.Input<aws.lb.TargetGroup>;
readonly targetGroupArn?: pulumi.Input<string>;
}
export interface DomainConfigurationInputs {
readonly domainNameConfiguration: pulumi.Input<aws.types.input.apigatewayv2.DomainNameDomainNameConfiguration>;
readonly mutualTlsAuthentication?: pulumi.Input<aws.types.input.apigatewayv2.DomainNameMutualTlsAuthentication>;
readonly tags?: pulumi.Input<Record<string, pulumi.Input<string>>>;
}
export interface DomainConfigurationOutputs {
readonly domainNameConfiguration: pulumi.Output<aws.types.output.apigatewayv2.DomainNameDomainNameConfiguration>;
readonly mutualTlsAuthentication?: pulumi.Output<aws.types.output.apigatewayv2.DomainNameMutualTlsAuthentication>;
readonly tags?: pulumi.Output<Record<string, string>>;
}
export interface DomainMappingInputs {
readonly apiMappingKey?: pulumi.Input<string>;
readonly domainConfiguration?: DomainConfigurationInputs;
readonly domainId?: pulumi.Input<string>;
readonly domainName?: DomainNameInputs;
readonly stage: pulumi.Input<string>;
}
export interface DomainMappingOutputs {
readonly apiMappingKey?: pulumi.Output<string>;
readonly domainConfiguration?: DomainConfigurationOutputs;
readonly domainId?: pulumi.Output<string>;
readonly domainName?: DomainNameOutputs;
readonly stage: pulumi.Output<string>;
}
export interface DomainNameInputs {
readonly domainNameConfiguration: pulumi.Input<aws.types.input.apigatewayv2.DomainNameDomainNameConfiguration>;
readonly mutualTlsAuthentication?: pulumi.Input<aws.types.input.apigatewayv2.DomainNameMutualTlsAuthentication>;
readonly tags?: pulumi.Input<Record<string, pulumi.Input<string>>>;
}
export interface DomainNameOutputs {
readonly domainNameConfiguration: pulumi.Output<aws.types.output.apigatewayv2.DomainNameDomainNameConfiguration>;
readonly mutualTlsAuthentication?: pulumi.Output<aws.types.output.apigatewayv2.DomainNameMutualTlsAuthentication>;
readonly tags?: pulumi.Output<Record<string, string>>;
}
export interface HttpAuthorizerInputs {
readonly authorizerCredentialsArn?: pulumi.Input<string>;
readonly authorizerPayloadFormatVersion?: pulumi.Input<string>;
Expand Down
54 changes: 27 additions & 27 deletions schema.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions schemagen/pkg/gen/apigatewayv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ func generateApiGatewayV2(awsSpec schema.PackageSpec) schema.PackageSpec {
"awsx:apigatewayv2:HttpApi": httpApi(awsSpec),
},
Types: map[string]schema.ComplexTypeSpec{
"awsx:apigatewayv2:HttpRoute": httpRoute(awsSpec),
"awsx:apigatewayv2:HttpIntegration": httpIntegration(awsSpec),
"awsx:apigatewayv2:HttpAuthorizer": httpAuthorizer(awsSpec),
"awsx:apigatewayv2:HttpStage": httpStage(awsSpec),
"awsx:apigatewayv2:DomainMapping": domainMapping(awsSpec),
"awsx:apigatewayv2:DomainConfiguration": domainConfiguration(awsSpec),
"awsx:apigatewayv2:HttpRoute": httpRoute(awsSpec),
"awsx:apigatewayv2:HttpIntegration": httpIntegration(awsSpec),
"awsx:apigatewayv2:HttpAuthorizer": httpAuthorizer(awsSpec),
"awsx:apigatewayv2:HttpStage": httpStage(awsSpec),
"awsx:apigatewayv2:DomainMapping": domainMapping(awsSpec),
"awsx:apigatewayv2:DomainName": domainName(awsSpec),
},
}
}
Expand Down Expand Up @@ -221,16 +221,16 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec {
original := awsSpec.Resources["aws:apigatewayv2/apiMapping:ApiMapping"]
properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties)
delete(properties, "apiId")
delete(properties, "domainName")
properties["domainConfiguration"] = schema.PropertySpec{
delete(properties, "domainName") // Inferred from the map key
properties["domainName"] = schema.PropertySpec{
Description: "Configuration of the domain name to create. Cannot be specified together with `domainId`.",
TypeSpec: schema.TypeSpec{
Ref: localRef("apigatewayv2", "DomainConfiguration"),
Ref: localRef("apigatewayv2", "DomainName"),
Plain: true,
},
}
properties["domainId"] = schema.PropertySpec{
Description: "Identifier of an existing domain. Cannot be specified together with `domainConfiguration`.",
Description: "Identifier of an existing domain. Cannot be specified together with `DomainName`.",
TypeSpec: schema.TypeSpec{
Type: "string",
},
Expand All @@ -245,7 +245,7 @@ func domainMapping(awsSpec schema.PackageSpec) schema.ComplexTypeSpec {
}
}

func domainConfiguration(awsSpec schema.PackageSpec) schema.ComplexTypeSpec {
func domainName(awsSpec schema.PackageSpec) schema.ComplexTypeSpec {
original := awsSpec.Resources["aws:apigatewayv2/domainName:DomainName"]
properties := renameAwsPropertiesRefs(awsSpec, original.InputProperties)
delete(properties, "domainName")
Expand Down
12 changes: 6 additions & 6 deletions sdk/dotnet/Apigatewayv2/Inputs/DomainMappingArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,16 @@ public sealed class DomainMappingArgs : global::Pulumi.ResourceArgs
public Input<string>? ApiMappingKey { get; set; }

/// <summary>
/// Configuration of the domain name to create. Cannot be specified together with `domainId`.
/// Identifier of an existing domain. Cannot be specified together with `DomainName`.
/// </summary>
[Input("domainConfiguration")]
public Inputs.DomainConfigurationArgs? DomainConfiguration { get; set; }
[Input("domainId")]
public Input<string>? DomainId { get; set; }

/// <summary>
/// Identifier of an existing domain. Cannot be specified together with `domainConfiguration`.
/// Configuration of the domain name to create. Cannot be specified together with `domainId`.
/// </summary>
[Input("domainId")]
public Input<string>? DomainId { get; set; }
[Input("domainName")]
public Inputs.DomainNameArgs? DomainName { get; set; }

/// <summary>
/// API stage. Use the `aws.apigatewayv2.Stage` resource to configure an API stage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ namespace Pulumi.Awsx.Apigatewayv2.Inputs
/// ```
///
/// </summary>
public sealed class DomainConfigurationArgs : global::Pulumi.ResourceArgs
public sealed class DomainNameArgs : global::Pulumi.ResourceArgs
{
/// <summary>
/// Domain name configuration. See below.
Expand All @@ -375,9 +375,9 @@ public InputMap<string> Tags
set => _tags = value;
}

public DomainConfigurationArgs()
public DomainNameArgs()
{
}
public static new DomainConfigurationArgs Empty => new DomainConfigurationArgs();
public static new DomainNameArgs Empty => new DomainNameArgs();
}
}
Loading

0 comments on commit 3d7688f

Please sign in to comment.