Class AssetApiDefinition
OpenAPI specification from a local file.
Inherited Members
Namespace: Amazon.CDK.AWS.APIGateway
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AssetApiDefinition : ApiDefinition
Syntax (vb)
Public Class AssetApiDefinition
Inherits ApiDefinition
Remarks
ExampleMetadata: infused
Examples
var myApiDefinition = ApiDefinition.FromAsset("path-to-file.json");
var specRestApi = new SpecRestApi(this, "my-specrest-api", new SpecRestApiProps {
Deploy = false,
ApiDefinition = myApiDefinition
});
// Use `stageName` to deploy to an existing stage
var deployment = new Deployment(this, "my-deployment", new DeploymentProps {
Api = specRestApi,
StageName = "dev",
RetainDeployments = true
});
// Trigger a new deployment on OpenAPI definition updates
deployment.AddToLogicalId(myApiDefinition);
Synopsis
Constructors
Asset |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Asset |
Used by jsii to construct an instance of this class from DeputyProps |
Asset |
Methods
Bind(Construct) | Called when the specification is initialized to allow this object to bind to the stack, add resources and have fun. |
Bind |
Called after the CFN RestApi resource has been created to allow the Api Definition to bind to it. |
Constructors
AssetApiDefinition(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AssetApiDefinition(ByRefValue reference)
Parameters
- reference Amazon.
JSII. Runtime. Deputy. By Ref Value The Javascript-owned object reference
AssetApiDefinition(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AssetApiDefinition(DeputyBase.DeputyProps props)
Parameters
- props Amazon.
JSII. Runtime. Deputy. Deputy Base. Deputy Props The deputy props
AssetApiDefinition(String, IAssetOptions)
public AssetApiDefinition(string path, IAssetOptions options = null)
Parameters
- path System.
String - options IAsset
Options
Methods
Bind(Construct)
Called when the specification is initialized to allow this object to bind to the stack, add resources and have fun.
public override IApiDefinitionConfig Bind(Construct scope)
Parameters
- scope Constructs.
Construct
Returns
Overrides
BindAfterCreate(Construct, IRestApi)
Called after the CFN RestApi resource has been created to allow the Api Definition to bind to it.
public override void BindAfterCreate(Construct scope, IRestApi restApi)
Parameters
- scope Constructs.
Construct - restApi IRest
Api
Overrides
Remarks
Specifically it's required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.