# ConfigurationContent

Defines the hosted configuration content.

Obtainable from: ConfigurationContent.fromFile, ConfigurationContent.fromInline, ConfigurationContent.fromInlineJson, ConfigurationContent.fromInlineText, ConfigurationContent.fromInlineYaml

- Source: [`aws-appconfig/lib/configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts#L864)
- Type last changed: v2.130.0 · 23 Feb 2024

## Example

TypeScript:

```ts
declare const application: appconfig.Application;
declare const fn: lambda.Function;

new appconfig.HostedConfiguration(this, 'MyHostedConfiguration', {
  application,
  content: appconfig.ConfigurationContent.fromInlineText('This is my configuration content.'),
  validators: [
    appconfig.JsonSchemaValidator.fromFile('schema.json'),
    appconfig.LambdaValidator.fromFunction(fn),
  ],
});
```

Python:

```python
# application: appconfig.Application
# fn: lambda.Function

appconfig.HostedConfiguration(self, "MyHostedConfiguration",
    application=application,
    content=appconfig.ConfigurationContent.from_inline_text("This is my configuration content."),
    validators=[
        appconfig.JsonSchemaValidator.from_file("schema.json"),
        appconfig.LambdaValidator.from_function(fn)
    ]
)
```

Java:

```java
Application application;
Function fn;

HostedConfiguration.Builder.create(this, "MyHostedConfiguration")
        .application(application)
        .content(ConfigurationContent.fromInlineText("This is my configuration content."))
        .validators(List.of(JsonSchemaValidator.fromFile("schema.json"), LambdaValidator.fromFunction(fn)))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Application application;
Function fn;

new HostedConfiguration(this, "MyHostedConfiguration", new HostedConfigurationProps {
    Application = application,
    Content = ConfigurationContent.FromInlineText("This is my configuration content."),
    Validators = new [] { JsonSchemaValidator.FromFile("schema.json"), LambdaValidator.FromFunction(fn) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var application Application
var fn Function

appconfig.NewHostedConfiguration(this, jsii.String("MyHostedConfiguration"), &HostedConfigurationProps{
	Application: Application,
	Content: appconfig.ConfigurationContent_FromInlineText(jsii.String("This is my configuration content.")),
	Validators: []IValidator{
		appconfig.JsonSchemaValidator_FromFile(jsii.String("schema.json")),
		appconfig.LambdaValidator_FromFunction(fn),
	},
})
```

## Initializer

TypeScript:

```ts
new ConfigurationContent()
```

Python:

```python
ConfigurationContent()
```

Java:

```java
new ConfigurationContent()
```

C# / .NET:

```csharp
new ConfigurationContent()
```

Golang:

```go
NewConfigurationContent()
```

## Properties

- `content`: string — The configuration content.

- `contentType`: string — The configuration content type, specified as a standard MIME type. Supported examples include: - `text/plain` - `application/json` - `application/octet-stream` - `application/x-yaml`.

  For an up-to-date list of valid MIME types, see:
  https://www.iana.org/assignments/media-types/media-types.xhtml

## Methods

- `fromFile(inputPath: string, contentType?: string): ConfigurationContent // chainable` (static) — Defines the hosted configuration content from a file.

  **Parameters**

  - `inputPath` — The path to the file that defines configuration content.
  - `contentType` — The configuration content type, specified as a standard MIME type. Supported examples include: - `text/plain` - `application/json` - `application/octet-stream` - `application/x-yaml`.

- `fromInline(content: string, contentType?: string): ConfigurationContent // chainable` (static) — Defines the hosted configuration content from inline code.

  **Parameters**

  - `content` — The inline code that defines the configuration content.
  - `contentType` — The configuration content type, specified as a standard MIME type. Supported examples include: - `text/plain` - `application/json` - `application/octet-stream` - `application/x-yaml`.

- `fromInlineJson(content: string, contentType?: string): ConfigurationContent // chainable` (static) — Defines the hosted configuration content as JSON from inline code.

  **Parameters**

  - `content` — The inline code that defines the configuration content.
  - `contentType` — The configuration content type, specified as a standard MIME type. Supported examples include: - `text/plain` - `application/json` - `application/octet-stream` - `application/x-yaml`.

- `fromInlineText(content: string): ConfigurationContent // chainable` (static) — Defines the hosted configuration content as text from inline code.

  **Parameters**

  - `content` — The inline code that defines the configuration content.

- `fromInlineYaml(content: string): ConfigurationContent // chainable` (static) — Defines the hosted configuration content as YAML from inline code.

  **Parameters**

  - `content` — The inline code that defines the configuration content.
