Class InitSource
Extract an archive into a directory.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class InitSource : InitElement
Syntax (vb)
Public MustInherit Class InitSource Inherits InitElement
Remarks
ExampleMetadata: infused
Examples
Bucket myBucket;
var handle = new InitServiceRestartHandle();
CloudFormationInit.FromElements(InitFile.FromString("/etc/nginx/nginx.conf", "...", new InitFileOptions { ServiceRestartHandles = new [] { handle } }), InitSource.FromS3Object("/var/www/html", myBucket, "html.zip", new InitSourceOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions {
ServiceRestartHandle = handle
}));
Synopsis
Constructors
| InitSource(string, InitServiceRestartHandle[]?) | Extract an archive into a directory. |
Properties
| ElementType | Returns the init element type for this element. |
Methods
| FromAsset(string, string, IInitSourceAssetOptions?) | Create an InitSource from an asset created from the given path. |
| FromExistingAsset(string, Asset, IInitSourceOptions?) | Extract a directory from an existing directory asset. |
| FromGitHub(string, string, string, string?, IInitSourceOptions?) | Extract a GitHub branch into a given directory. |
| FromS3Object(string, IBucket, string, IInitSourceOptions?) | Extract an archive stored in an S3 bucket into the given directory. |
| FromUrl(string, string, IInitSourceOptions?) | Retrieve a URL and extract it into the given directory. |
Constructors
InitSource(string, InitServiceRestartHandle[]?)
Extract an archive into a directory.
protected InitSource(string targetDirectory, InitServiceRestartHandle[]? serviceHandles = null)
Parameters
- targetDirectory string
- serviceHandles InitServiceRestartHandle[]
Remarks
ExampleMetadata: infused
Examples
Bucket myBucket;
var handle = new InitServiceRestartHandle();
CloudFormationInit.FromElements(InitFile.FromString("/etc/nginx/nginx.conf", "...", new InitFileOptions { ServiceRestartHandles = new [] { handle } }), InitSource.FromS3Object("/var/www/html", myBucket, "html.zip", new InitSourceOptions { ServiceRestartHandles = new [] { handle } }), InitService.Enable("nginx", new InitServiceOptions {
ServiceRestartHandle = handle
}));
Properties
ElementType
Returns the init element type for this element.
public override string ElementType { get; }
Property Value
Overrides
Remarks
ExampleMetadata: infused
Methods
FromAsset(string, string, IInitSourceAssetOptions?)
Create an InitSource from an asset created from the given path.
public static InitSource FromAsset(string targetDirectory, string path, IInitSourceAssetOptions? options = null)
Parameters
- targetDirectory string
- path string
- options IInitSourceAssetOptions
Returns
Remarks
ExampleMetadata: infused
FromExistingAsset(string, Asset, IInitSourceOptions?)
Extract a directory from an existing directory asset.
public static InitSource FromExistingAsset(string targetDirectory, Asset asset, IInitSourceOptions? options = null)
Parameters
- targetDirectory string
- asset Asset
- options IInitSourceOptions
Returns
Remarks
ExampleMetadata: infused
FromGitHub(string, string, string, string?, IInitSourceOptions?)
Extract a GitHub branch into a given directory.
public static InitSource FromGitHub(string targetDirectory, string owner, string repo, string? refSpec = null, IInitSourceOptions? options = null)
Parameters
- targetDirectory string
- owner string
- repo string
- refSpec string
- options IInitSourceOptions
Returns
Remarks
ExampleMetadata: infused
FromS3Object(string, IBucket, string, IInitSourceOptions?)
Extract an archive stored in an S3 bucket into the given directory.
public static InitSource FromS3Object(string targetDirectory, IBucket bucket, string key, IInitSourceOptions? options = null)
Parameters
- targetDirectory string
- bucket IBucket
- key string
- options IInitSourceOptions
Returns
Remarks
ExampleMetadata: infused
FromUrl(string, string, IInitSourceOptions?)
Retrieve a URL and extract it into the given directory.
public static InitSource FromUrl(string targetDirectory, string url, IInitSourceOptions? options = null)
Parameters
- targetDirectory string
- url string
- options IInitSourceOptions
Returns
Remarks
ExampleMetadata: infused