Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
aws apigateway中未更新swagger文件内容_Swagger_Aws Api Gateway_Amazon Cloudformation - Fatal编程技术网

aws apigateway中未更新swagger文件内容

aws apigateway中未更新swagger文件内容,swagger,aws-api-gateway,amazon-cloudformation,Swagger,Aws Api Gateway,Amazon Cloudformation,我正在处理swagger文件,在aws apigateway中创建授权程序。但那一次我将在swagger文件中提到一些函数和api。但它在apigateway中不起作用。一旦我删除了堆栈,它将影响APIgateway。如果未进行任何更改,则不会影响APIgateway。下面我将提到template.yml文件和swagger文件。请任何人帮助解决此问题 template.yml文件 AWST模板格式版本:“2010-09-09” 转换:AWS::Serverless-2016-10-31 描述:

我正在处理swagger文件,在aws apigateway中创建授权程序。但那一次我将在swagger文件中提到一些函数和api。但它在apigateway中不起作用。一旦我删除了堆栈,它将影响APIgateway。如果未进行任何更改,则不会影响APIgateway。下面我将提到template.yml文件和swagger文件。请任何人帮助解决此问题

template.yml文件

AWST模板格式版本:“2010-09-09”

转换:AWS::Serverless-2016-10-31

描述:TestApi

资源:

ApiGateway:

Type: AWS::Serverless::Api
Properties:
  StageName: Prod
  DefinitionUri: s3://devdeliforcemumbailambda/swagger-json-testapi.json
DriverDeleteF:

Type: AWS::Serverless::Function
Properties:
  FunctionName: driver_delete_fun
  Handler: index.handler
  Runtime: nodejs8.10
  CodeUri: build/authorizer.zip
  Events:
    GetApi:
      Type: Api
      Properties:
        Path: /driver
        Method: delete
炫耀文件内容

{

“招摇过市”:“2.0”

“信息”:{

},, “主机”:“rl0cg75uff.execute api.ap-south-1.amazonaws.com”

“基本路径”:“/Prod”

“计划”:[

],

“路径”:{

},, “安全定义”:{

},, “定义”:{

}
}

在DefinitionUri中指定S3URI时,Cloudformation不会比较s3对象的内容。相反,您可以指定一个相对本地路径,并让cloudformation cli为您上传它,就像它通常对函数代码所做的那样。然后,Cloudformation将在s3对象键中使用您的文件哈希,因此每次包含更改时都有不同的定义URI和CodeUri

因此,与其拥有这些:

DefinitionUri: s3://devdeliforcemumbailambda/swagger-json-testapi.json
CodeUri: build/authorizer.zip
这样做:

DefinitionUri: ./swagger-json-testapi.json
CodeUri: ./authorizer-code-directory
我写的内容适用于以下内容:()

AWS::ApiGateway::RestApi资源的BodyS3Location属性

AWS::Lambda::函数资源的代码属性

AWS::Serverless::函数资源的CodeUri属性

AWS::Serverless::Api资源的DefinitionUri属性

AWS::ElasticBeanstalk::ApplicationVersion资源的SourceBundle属性

AWS::CloudFormation::Stack资源的TemplateURL属性

按如下方式部署堆栈:

aws cloudformation package --template-file template.yaml --s3-bucket devdeliforcemumbailambda --output-template-file packaged-template.yaml

aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM --stack-name test-swagger --template-file packaged-template.yaml
"CognitoAuth": {
  "type": "apiKey",
  "name": "Authorization",
  "in": "header",
  "x-amazon-apigateway-authtype": "cognito_user_pools",
  "x-amazon-apigateway-authorizer": {
    "providerARNs": [
      "arn:aws:cognito-idp:ap-south-1:539977196287:userpool/ap-south-1_6j7axGXVm"
    ],
    "type": "cognito_user_pools"
  }
},
"lambdaAuth":{
  "type": "apiKey",
  "name": "Authorization",
  "in": "header",
  "x-amazon-apigateway-authtype": "custom",
  "x-amazon-apigateway-authorizer": { 
     "authorizerUri":  "arn:aws:apigateway:ap-south-1:lambda:path/2015-03-31/functions/arn:aws:lambda:ap-south-1:539977196287:function:my-service-dev-hello/invocations",
     "authorizerResultTtlInSeconds":1,
      "identitySource": "method.request.header.Authorization",
      "type": "request"
   }
}
"Empty": {

  "type": "object",

  "title": "Empty Schema"
}
DefinitionUri: s3://devdeliforcemumbailambda/swagger-json-testapi.json
CodeUri: build/authorizer.zip
DefinitionUri: ./swagger-json-testapi.json
CodeUri: ./authorizer-code-directory
aws cloudformation package --template-file template.yaml --s3-bucket devdeliforcemumbailambda --output-template-file packaged-template.yaml

aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM --stack-name test-swagger --template-file packaged-template.yaml