

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# HttpApi
<a name="sam-property-function-httpapi"></a>

Das Objekt, das eine Ereignisquelle mit Typ beschreibt HttpApi.

Wenn eine OpenApi Definition für den angegebenen Pfad und die angegebene Methode in der API vorhanden ist, fügt SAM den Abschnitt Lambda-Integration und -Sicherheit (falls zutreffend) für Sie hinzu.

Wenn in der API keine OpenApi Definition für den angegebenen Pfad und die angegebene Methode vorhanden ist, erstellt SAM diese Definition für Sie.

## Syntax
<a name="sam-property-function-httpapi-syntax"></a>

Verwenden Sie die folgende Syntax, um diese Entität in Ihrer Vorlage AWS Serverless Application Model (AWS SAM) zu deklarieren.

### YAML
<a name="sam-property-function-httpapi-syntax.yaml"></a>

```
  [ApiId](#sam-function-httpapi-apiid): String
  [Auth](#sam-function-httpapi-auth): HttpApiFunctionAuth
  [Method](#sam-function-httpapi-method): String
  [Path](#sam-function-httpapi-path): String
  [PayloadFormatVersion](#sam-function-httpapi-payloadformatversion): String
  [RouteSettings](#sam-function-httpapi-routesettings): [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)
  [TimeoutInMillis](#sam-function-httpapi-timeoutinmillis): Integer
```

## Eigenschaften
<a name="sam-property-function-httpapi-properties"></a>

 `ApiId`   <a name="sam-function-httpapi-apiid"></a>
Bezeichner einer in dieser Vorlage definierten [AWS::Serverless::HttpApi](sam-resource-httpapi.md) Ressource.  
Falls nicht definiert, wird eine [AWS::Serverless::HttpApi](sam-resource-httpapi.md) Standardressource erstellt, die `ServerlessHttpApi` mithilfe eines generierten OpenApi Dokuments aufgerufen wird, das eine Vereinigung aller Pfade und Methoden enthält, die durch API-Ereignisse definiert sind, die in dieser Vorlage definiert sind und keine angeben`ApiId`.  
Dies kann nicht auf eine in einer anderen Vorlage definierte [AWS::Serverless::HttpApi](sam-resource-httpapi.md) Ressource verweisen.  
*Typ:* Zeichenfolge  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `Auth`   <a name="sam-function-httpapi-auth"></a>
Authentifizierungskonfiguration für diese spezielle API\$1Path\$1Methode.  
Nützlich, um die APIs zu überschreiben `DefaultAuthorizer` oder die Authentifizierungskonfiguration für einen einzelnen Pfad festzulegen, wenn keine angegeben ist. `DefaultAuthorizer`  
*Typ:* [HttpApiFunctionAuth](sam-property-function-httpapifunctionauth.md)  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `Method`   <a name="sam-function-httpapi-method"></a>
HTTP-Methode, für die diese Funktion aufgerufen wird.  
Wenn nein `Path` und angegeben `Method` sind, erstellt SAM einen Standard-API-Pfad, der alle Anfragen weiterleitet, die nicht einem anderen Endpunkt dieser Lambda-Funktion zugeordnet sind. Pro API kann nur einer dieser Standardpfade existieren.  
*Typ:* Zeichenfolge  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `Path`   <a name="sam-function-httpapi-path"></a>
URI-Pfad, für den diese Funktion aufgerufen wird. Muss mit `/` beginnen.  
Wenn nein `Path` und angegeben `Method` sind, erstellt SAM einen Standard-API-Pfad, der alle Anfragen weiterleitet, die nicht einem anderen Endpunkt dieser Lambda-Funktion zugeordnet sind. Pro API kann nur einer dieser Standardpfade existieren.  
*Typ:* Zeichenfolge  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `PayloadFormatVersion`   <a name="sam-function-httpapi-payloadformatversion"></a>
Gibt das Format der an eine Integration gesendeten Nutzlast an.  
HINWEIS: PayloadFormatVersion erfordert, dass SAM Ihre OpenAPI-Definition ändert, sodass es nur mit Inline funktioniert, die in der `DefinitionBody` Eigenschaft OpenApi definiert ist.  
*Typ:* Zeichenfolge  
*Required*: No  
*Standard*: 2.0  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `RouteSettings`   <a name="sam-function-httpapi-routesettings"></a>
Die Routeneinstellungen pro Route für diese HTTP-API. Weitere Informationen zu Routeneinstellungen finden Sie [AWS::ApiGatewayV2::Stage RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-stage-routesettings.html)im *API Gateway Developer Guide*.  
Hinweis: Wenn sie sowohl in der HttpApi Ressource als auch in der Ereignisquelle angegeben RouteSettings sind, werden sie mit den Eigenschaften der Ereignisquelle AWS SAM zusammengeführt, die Vorrang haben.  
*Typ:* [RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft wird direkt an die `[RouteSettings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-stage.html#cfn-apigatewayv2-stage-routesettings)` Eigenschaft einer `AWS::ApiGatewayV2::Stage` Ressource übergeben.

 `TimeoutInMillis`   <a name="sam-function-httpapi-timeoutinmillis"></a>
Benutzerdefinierte Zeitüberschreitung zwischen 50 und 29.000 Millisekunden.  
HINWEIS: TimeoutInMillis erfordert, dass SAM Ihre OpenAPI-Definition ändert, sodass es nur mit Inline funktioniert, die in der `DefinitionBody` Eigenschaft OpenApi definiert ist.  
*Typ*: Ganzzahl  
*Required*: No  
*Standard*: 5000  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

## Beispiele
<a name="sam-property-function-httpapi--examples"></a>

### HttpApi Standardereignis
<a name="sam-property-function-httpapi--examples--default-httpapi-event"></a>

HttpApi Ereignis, das den Standardpfad verwendet. Alle nicht zugewiesenen Pfade und Methoden auf dieser API werden zu diesem Endpunkt weitergeleitet.

#### YAML
<a name="sam-property-function-httpapi--examples--default-httpapi-event--yaml"></a>

```
Events:
  HttpApiEvent:
    Type: HttpApi
```

### HttpApi
<a name="sam-property-function-httpapi--examples--httpapi"></a>

HttpApi Ereignis, das einen bestimmten Pfad und eine bestimmte Methode verwendet.

#### YAML
<a name="sam-property-function-httpapi--examples--httpapi--yaml"></a>

```
Events:
  HttpApiEvent:
    Type: HttpApi
    Properties:
      Path: /
      Method: GET
```

### HttpApi Autorisierung
<a name="sam-property-function-httpapi--examples--httpapi-authorization"></a>

HttpApi Ereignis, das einen Authorizer verwendet.

#### YAML
<a name="sam-property-function-httpapi--examples--httpapi-authorization--yaml"></a>

```
Events:
  HttpApiEvent:
    Type: HttpApi
    Properties:
      Path: /authenticated
      Method: GET
      Auth:
        Authorizer: OpenIdAuth
        AuthorizationScopes:
          - scope1
          - scope2
```

# HttpApiFunctionAuth
<a name="sam-property-function-httpapifunctionauth"></a>

Konfiguriert die Autorisierung auf Veranstaltungsebene.

Konfigurieren Sie Auth für eine bestimmte API \$1 Path \$1 Methode

## Syntax
<a name="sam-property-function-httpapifunctionauth-syntax"></a>

Verwenden Sie die folgende Syntax, um diese Entität in Ihrer AWS Serverless Application Model (AWS SAM) -Vorlage zu deklarieren.

### YAML
<a name="sam-property-function-httpapifunctionauth-syntax.yaml"></a>

```
  [AuthorizationScopes](#sam-function-httpapifunctionauth-authorizationscopes): List
  [Authorizer](#sam-function-httpapifunctionauth-authorizer): String
```

## Eigenschaften
<a name="sam-property-function-httpapifunctionauth-properties"></a>

 `AuthorizationScopes`   <a name="sam-function-httpapifunctionauth-authorizationscopes"></a>
Die Autorisierungsbereiche, die für diese API, diesen Pfad und diese Methode gelten sollen.  
Die hier aufgelisteten Bereiche setzen alle Bereiche außer Kraft, die von angewendet werden, `DefaultAuthorizer` falls vorhanden.  
*Typ*: Liste  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

 `Authorizer`   <a name="sam-function-httpapifunctionauth-authorizer"></a>
Die `Authorizer` für eine bestimmte Funktion. Um die IAM-Autorisierung zu verwenden, geben Sie `EnableIamAuthorizer` im `Globals` Abschnitt Ihrer Vorlage die Angabe `AWS_IAM` und Spezifizierung `true` für an.  
Wenn Sie in der API einen Global Authorizer angegeben haben und eine bestimmte Funktion öffentlich machen möchten, überschreiben Sie dies, indem Sie auf setzen`Authorizer`. `NONE`  
*Typ:* Zeichenfolge  
*Required*: No  
*CloudFormation Kompatibilität*: Diese Eigenschaft ist einzigartig für AWS SAM und hat kein CloudFormation Äquivalent.

## Beispiele
<a name="sam-property-function-httpapifunctionauth--examples"></a>

### Funktions-Auth
<a name="sam-property-function-httpapifunctionauth--examples--function-auth"></a>

Autorisierung auf Funktionsebene angeben

#### YAML
<a name="sam-property-function-httpapifunctionauth--examples--function-auth--yaml"></a>

```
Auth:
  Authorizer: OpenIdAuth
  AuthorizationScopes:
    - scope1
    - scope2
```

### IAM-Autorisierung
<a name="sam-property-function-httpapifunctionauth--examples--iam-authorization"></a>

Gibt die IAM-Autorisierung auf Ereignisebene an. Um die `AWS_IAM` Autorisierung auf Veranstaltungsebene zu verwenden, müssen Sie `EnableIamAuthorizer` im `Globals` Abschnitt Ihrer Vorlage auch `true` for angeben. Weitere Informationen finden Sie unter [Abschnitt „Globals“ der Vorlage AWS SAM](sam-specification-template-anatomy-globals.md).

#### YAML
<a name="sam-property-function-httpapifunctionauth--examples--iam-authorization--yaml"></a>

```
Globals:
  HttpApi:
    Auth:
      EnableIamAuthorizer: true

Resources:
  HttpApiFunctionWithIamAuth:
    Type: AWS::Serverless::Function
    Properties:
      Events:
        ApiEvent:
          Type: HttpApi
          Properties:
            Path: /iam-auth
            Method: GET
            Auth:
              Authorizer: AWS_IAM
      Handler: index.handler
      InlineCode: |
        def handler(event, context):
          return {'body': 'HttpApiFunctionWithIamAuth', 'statusCode': 200}
      Runtime: python3.9
```