# NamedPackageOptions

Options for InitPackage.yum/apt/rubyGem/python.

Used as argument in: [InitPackage.apt](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitPackage.html#apt), [InitPackage.python](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitPackage.html#python), [InitPackage.rubyGem](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitPackage.html#rubygem), InitPackage.yum

- Source: [`aws-ec2/lib/cfn-init-elements.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts#L637)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const initServiceRestartHandle: ec2.InitServiceRestartHandle;
const namedPackageOptions: ec2.NamedPackageOptions = {
  serviceRestartHandles: [initServiceRestartHandle],
  version: ['version'],
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# init_service_restart_handle: ec2.InitServiceRestartHandle

named_package_options = ec2.NamedPackageOptions(
    service_restart_handles=[init_service_restart_handle],
    version=["version"]
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

InitServiceRestartHandle initServiceRestartHandle;

NamedPackageOptions namedPackageOptions = NamedPackageOptions.builder()
        .serviceRestartHandles(List.of(initServiceRestartHandle))
        .version(List.of("version"))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

InitServiceRestartHandle initServiceRestartHandle;

var namedPackageOptions = new NamedPackageOptions {
    ServiceRestartHandles = new [] { initServiceRestartHandle },
    Version = new [] { "version" }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var initServiceRestartHandle InitServiceRestartHandle

namedPackageOptions := &NamedPackageOptions{
	ServiceRestartHandles: []InitServiceRestartHandle{
		initServiceRestartHandle,
	},
	Version: []*string{
		jsii.String("version"),
	},
}
```

## Properties

- `serviceRestartHandles`: [InitServiceRestartHandle](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InitServiceRestartHandle.html)[] — Restart the given services after this command has run.

  **Default:** Do not restart any service

- `version`: string[] — Specify the versions to install.

  **Default:** Install the latest version
