# AWS Core

### Imports

{% tabs %}
{% tab title="Service" %}

```typescript
import { AwsCoreService } from 'niro-health';
```

{% endtab %}

{% tab title="Module" %}

```typescript
import { AwsCoreModule } from 'niro-health';
```

{% endtab %}

{% tab title="Interface" %}

```typescript
import type { IAwsCoreService } from 'niro-health';
```

{% endtab %}
{% endtabs %}

### Application Variables

<table><thead><tr><th width="208">name</th><th width="229">example</th><th width="126">reference</th><th>description</th></tr></thead><tbody><tr><td><code>aws_api_version</code></td><td><code>latest</code> | <code>2015-03-31</code></td><td><a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html">API Version</a></td><td><code>AWS API version from the configuration.</code></td></tr><tr><td><code>aws_region</code></td><td><code>us-east-1</code></td><td><a href="https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/RegionsAndAZs.html">Regions List</a></td><td><code>AWS region from the configuration.</code></td></tr></tbody></table>

#### How to set variable

You can set the application variable in your main module and/or in the module that will inject the service.

```typescript
import { Inject, Injectable } from '@nestjs/common';
import type { IConfigurationService } from 'niro-health';

@Injectable()
export class AppService {
  constructor(
    @Inject('IConfigurationService')
    private readonly configurationService: IConfigurationService,
  ) {
  this.initialize();
}

  async initialize() {
    this.configurationService.setVariable('aws_api_version', 'latest');
    this.configurationService.setVariable('aws_region', 'us-east-1');
  }
}
```

### Method of Use

To use this module, you need to inject it into the desired service.

{% code overflow="wrap" %}

```typescript
import { Module } from '@nestjs/common';
import {
  AwsCoreService,
  AwsConfigurationService,
  AwsStsService,
  ConfigurationService,
  ValidatorRegexpService,
  StringExService,
} from 'niro-health';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  controllers: [AppController],
  providers: [
    AppService,
    {
      provide: 'IAwsCoreServiceImpl',
      useClass: AwsCoreService,
    },
    {
      provide: 'IAwsConfigurationService',
      useClass: AwsConfigurationService,
    },
    {
      provide: 'IAwsStsService',
      useClass: AwsStsService,
    },
    {
      provide: 'IConfigurationService',
      useClass: ConfigurationService,
    },
    {
      provide: 'IValidatorRegexpService',
      useClass: ValidatorRegexpService,
    },
    {
      provide: 'IStringExService',
      useClass: StringExService,
    },
  ],
})
export class AppModule {}
```

{% endcode %}

Injecting the module into our service.

```typescript
import { Inject, Injectable } from '@nestjs/common';
import type { IAwsCoreServiceImpl } from 'niro-health';

@Injectable()
export class AppService {
  constructor(
    @Inject('IAwsCoreServiceImpl')
    private readonly awsCoreService: IAwsCoreServiceImpl,
  ) {}

  async configuration() {
    return await this.awsCoreService.configuration();
  }
}
```

### With dependencies

You will need to inject the following interfaces.

<table><thead><tr><th width="308">Interface</th><th>Service</th></tr></thead><tbody><tr><td><code>IConfigurationService</code></td><td><a href="/pages/qVNUf3tpeJXEx7j4GiuW">Link to Service documentation</a></td></tr><tr><td><code>IValidatorRegexpService</code></td><td><a href="/pages/O8NjCtcCgk2uaVu1oyq5">Link to Service documentation</a></td></tr><tr><td><code>IStringExService</code></td><td><a href="/pages/9boqQn1bIK4z9uqBM3n0">Link to Service documentation</a></td></tr><tr><td><code>IAwsConfigurationService</code></td><td><a href="/pages/0brohd55lElyqphTnlly">Link to Service documentation</a></td></tr><tr><td><code>IAwsStsService</code></td><td><a href="/pages/9mbvmC1qDU1pkGOyhBGV">Link to Service documentation</a></td></tr></tbody></table>

### Properties

<table><thead><tr><th>Property</th><th width="114.33333333333331" align="center">Scope</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:blue;">get</mark> <code>_apiVersion</code></td><td align="center"><code>private</code></td><td><code>Get the AWS API version from the configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>_region</code></td><td align="center"><code>private</code></td><td><code>Get the AWS region from the configuration.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>_httpOptions</code></td><td align="center"><code>private</code></td><td><code>Get the AWS HTTP options.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>_credentials</code></td><td align="center"><code>private</code></td><td><code>Get the AWS configuration service.</code></td></tr><tr><td><mark style="color:blue;">get</mark> <code>_sts</code></td><td align="center"><code>private</code></td><td><code>Get the AWS STS service.</code></td></tr></tbody></table>

### Methods

<table><thead><tr><th>Method</th><th width="113.33333333333331" align="center">Scope</th><th>Description</th></tr></thead><tbody><tr><td><code>initialize</code></td><td align="center"><code>private</code></td><td><code>Initialize the AWS configuration.</code></td></tr><tr><td><code>client</code></td><td align="center"><code>public</code></td><td><code>Get the client for the AWS services.</code></td></tr><tr><td><code>setRole3rdParty</code></td><td align="center"><code>public</code></td><td><code>Set the role for the 3rd party.</code></td></tr><tr><td><code>configuration</code></td><td align="center"><code>public</code></td><td><code>Get the AWS configuration.</code></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guilhermesantos.gitbook.io/niro-health/modules/aws-core.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
