예제 #1
0
 public MyStack()
 {
     var testRestApi = new Aws.ApiGateway.RestApi("testRestApi", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
     var testDeployment = new Aws.ApiGateway.Deployment("testDeployment", new Aws.ApiGateway.DeploymentArgs
     {
         RestApi   = testRestApi.Id,
         StageName = "dev",
     }, new CustomResourceOptions
     {
         DependsOn =
         {
             "aws_api_gateway_integration.test",
         },
     });
     var testStage = new Aws.ApiGateway.Stage("testStage", new Aws.ApiGateway.StageArgs
     {
         Deployment = testDeployment.Id,
         RestApi    = testRestApi.Id,
         StageName  = "prod",
     });
     var testResource = new Aws.ApiGateway.Resource("testResource", new Aws.ApiGateway.ResourceArgs
     {
         ParentId = testRestApi.RootResourceId,
         PathPart = "mytestresource",
         RestApi  = testRestApi.Id,
     });
     var testMethod = new Aws.ApiGateway.Method("testMethod", new Aws.ApiGateway.MethodArgs
     {
         Authorization = "NONE",
         HttpMethod    = "GET",
         ResourceId    = testResource.Id,
         RestApi       = testRestApi.Id,
     });
     var methodSettings = new Aws.ApiGateway.MethodSettings("methodSettings", new Aws.ApiGateway.MethodSettingsArgs
     {
         MethodPath = Output.Tuple(testResource.PathPart, testMethod.HttpMethod).Apply(values =>
         {
             var pathPart   = values.Item1;
             var httpMethod = values.Item2;
             return($"{pathPart}/{httpMethod}");
         }),
         RestApi  = testRestApi.Id,
         Settings = new Aws.ApiGateway.Inputs.MethodSettingsSettingsArgs
         {
             LoggingLevel   = "INFO",
             MetricsEnabled = true,
         },
         StageName = testStage.StageName,
     });
     var testIntegration = new Aws.ApiGateway.Integration("testIntegration", new Aws.ApiGateway.IntegrationArgs
     {
         HttpMethod = testMethod.HttpMethod,
         ResourceId = testResource.Id,
         RestApi    = testRestApi.Id,
         Type       = "MOCK",
     });
 }
예제 #2
0
 public MyStack()
 {
     var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
     var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
     {
         ParentId = myDemoAPI.RootResourceId,
         PathPart = "mydemoresource",
         RestApi  = myDemoAPI.Id,
     });
     var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
     {
         Authorization = "NONE",
         HttpMethod    = "GET",
         ResourceId    = myDemoResource.Id,
         RestApi       = myDemoAPI.Id,
     });
     var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
     {
         HttpMethod = myDemoMethod.HttpMethod,
         ResourceId = myDemoResource.Id,
         RestApi    = myDemoAPI.Id,
         Type       = "MOCK",
     });
     var response200 = new Aws.ApiGateway.MethodResponse("response200", new Aws.ApiGateway.MethodResponseArgs
     {
         HttpMethod = myDemoMethod.HttpMethod,
         ResourceId = myDemoResource.Id,
         RestApi    = myDemoAPI.Id,
         StatusCode = "200",
     });
 }
예제 #3
0
 public MyStack()
 {
     var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
 }
예제 #4
0
 public MyStack()
 {
     var exampleRestApi = new Aws.ApiGateway.RestApi("exampleRestApi", new Aws.ApiGateway.RestApiArgs
     {
     });
     var exampleDocumentationVersion = new Aws.ApiGateway.DocumentationVersion("exampleDocumentationVersion", new Aws.ApiGateway.DocumentationVersionArgs
     {
         Description = "Example description",
         RestApiId   = exampleRestApi.Id,
         Version     = "example_version",
     }, new CustomResourceOptions
     {
         DependsOn =
         {
             "aws_api_gateway_documentation_part.example",
         },
     });
     var exampleDocumentationPart = new Aws.ApiGateway.DocumentationPart("exampleDocumentationPart", new Aws.ApiGateway.DocumentationPartArgs
     {
         Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
         {
             Type = "API",
         },
         Properties = "{\"description\":\"Example\"}",
         RestApiId  = exampleRestApi.Id,
     });
 }
예제 #5
0
 public MyStack()
 {
     var test = new Aws.ApiGateway.RestApi("test", new Aws.ApiGateway.RestApiArgs
     {
     });
     var myusageplan = new Aws.ApiGateway.UsagePlan("myusageplan", new Aws.ApiGateway.UsagePlanArgs
     {
         ApiStages =
         {
             new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
             {
                 ApiId = test.Id,
                 Stage = aws_api_gateway_deployment.Foo.Stage_name,
             },
         },
     });
     var mykey = new Aws.ApiGateway.ApiKey("mykey", new Aws.ApiGateway.ApiKeyArgs
     {
     });
     var main = new Aws.ApiGateway.UsagePlanKey("main", new Aws.ApiGateway.UsagePlanKeyArgs
     {
         KeyId       = mykey.Id,
         KeyType     = "API_KEY",
         UsagePlanId = myusageplan.Id,
     });
 }
예제 #6
0
 public MyStack()
 {
     var example = new Aws.ApiGateway.RestApi("example", new Aws.ApiGateway.RestApiArgs
     {
         EndpointConfiguration = new Aws.ApiGateway.Inputs.RestApiEndpointConfigurationArgs
         {
             Types = "REGIONAL",
         },
     });
 }
예제 #7
0
 public MyStack()
 {
     var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
     var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
     {
         ParentId = myDemoAPI.RootResourceId,
         PathPart = "mydemoresource",
         RestApi  = myDemoAPI.Id,
     });
 }
예제 #8
0
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
        {
            ParentId = myDemoAPI.RootResourceId,
            PathPart = "mydemoresource",
            RestApi  = myDemoAPI.Id,
        });
        var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
        {
            Authorization = "NONE",
            HttpMethod    = "GET",
            ResourceId    = myDemoResource.Id,
            RestApi       = myDemoAPI.Id,
        });
        var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
        {
            HttpMethod = myDemoMethod.HttpMethod,
            ResourceId = myDemoResource.Id,
            RestApi    = myDemoAPI.Id,
            Type       = "MOCK",
        });
        var response200 = new Aws.ApiGateway.MethodResponse("response200", new Aws.ApiGateway.MethodResponseArgs
        {
            HttpMethod = myDemoMethod.HttpMethod,
            ResourceId = myDemoResource.Id,
            RestApi    = myDemoAPI.Id,
            StatusCode = "200",
        });
        var myDemoIntegrationResponse = new Aws.ApiGateway.IntegrationResponse("myDemoIntegrationResponse", new Aws.ApiGateway.IntegrationResponseArgs
        {
            HttpMethod        = myDemoMethod.HttpMethod,
            ResourceId        = myDemoResource.Id,
            ResponseTemplates =
            {
                { "application/xml", @"#set($inputRoot = $input.path('$'))
<?xml version=""1.0"" encoding=""UTF-8""?>
<message>
    $inputRoot.body
</message>

" },
            },
            RestApi    = myDemoAPI.Id,
            StatusCode = response200.StatusCode,
        });
    }
예제 #9
0
 public MyStack()
 {
     var exampleRestApi = new Aws.ApiGateway.RestApi("exampleRestApi", new Aws.ApiGateway.RestApiArgs
     {
     });
     var exampleDocumentationPart = new Aws.ApiGateway.DocumentationPart("exampleDocumentationPart", new Aws.ApiGateway.DocumentationPartArgs
     {
         Location = new Aws.ApiGateway.Inputs.DocumentationPartLocationArgs
         {
             Method = "GET",
             Path   = "/example",
             Type   = "METHOD",
         },
         Properties = "{\"description\":\"Example description\"}",
         RestApiId  = exampleRestApi.Id,
     });
 }
예제 #10
0
 public MyStack()
 {
     var myapi = new Aws.ApiGateway.RestApi("myapi", new Aws.ApiGateway.RestApiArgs
     {
     });
     var dev = new Aws.ApiGateway.Deployment("dev", new Aws.ApiGateway.DeploymentArgs
     {
         RestApi   = myapi.Id,
         StageName = "dev",
     });
     var prod = new Aws.ApiGateway.Deployment("prod", new Aws.ApiGateway.DeploymentArgs
     {
         RestApi   = myapi.Id,
         StageName = "prod",
     });
     var myUsagePlan = new Aws.ApiGateway.UsagePlan("myUsagePlan", new Aws.ApiGateway.UsagePlanArgs
     {
         ApiStages =
         {
             new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
             {
                 ApiId = myapi.Id,
                 Stage = dev.StageName,
             },
             new Aws.ApiGateway.Inputs.UsagePlanApiStageArgs
             {
                 ApiId = myapi.Id,
                 Stage = prod.StageName,
             },
         },
         Description   = "my description",
         ProductCode   = "MYCODE",
         QuotaSettings = new Aws.ApiGateway.Inputs.UsagePlanQuotaSettingsArgs
         {
             Limit  = 20,
             Offset = 2,
             Period = "WEEK",
         },
         ThrottleSettings = new Aws.ApiGateway.Inputs.UsagePlanThrottleSettingsArgs
         {
             BurstLimit = 5,
             RateLimit  = 10,
         },
     });
 }
예제 #11
0
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
        {
            ParentId = myDemoAPI.RootResourceId,
            PathPart = "mydemoresource",
            RestApi  = myDemoAPI.Id,
        });
        var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
        {
            Authorization = "NONE",
            HttpMethod    = "GET",
            ResourceId    = myDemoResource.Id,
            RestApi       = myDemoAPI.Id,
        });
        var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
        {
            CacheKeyParameters =
            {
                "method.request.path.param",
            },
            CacheNamespace    = "foobar",
            HttpMethod        = myDemoMethod.HttpMethod,
            RequestParameters =
            {
                { "integration.request.header.X-Authorization", "'static'" },
            },
            RequestTemplates =
            {
                { "application/xml", @"{
   ""body"" : $input.json('$')
}

" },
            },
            ResourceId          = myDemoResource.Id,
            RestApi             = myDemoAPI.Id,
            TimeoutMilliseconds = 29000,
            Type = "MOCK",
        });
    }
예제 #12
0
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoModel = new Aws.ApiGateway.Model("myDemoModel", new Aws.ApiGateway.ModelArgs
        {
            ContentType = "application/json",
            Description = "a JSON schema",
            RestApi     = myDemoAPI.Id,
            Schema      = @"{
  ""type"": ""object""
}

",
        });
    }
예제 #13
0
 public MyStack()
 {
     var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
     var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
     {
         RestApi  = myDemoAPI.Id,
         ParentId = myDemoAPI.RootResourceId,
         PathPart = "test",
     });
     var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
     {
         RestApi       = myDemoAPI.Id,
         ResourceId    = myDemoResource.Id,
         HttpMethod    = "GET",
         Authorization = "NONE",
     });
     var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
     {
         RestApi    = myDemoAPI.Id,
         ResourceId = myDemoResource.Id,
         HttpMethod = myDemoMethod.HttpMethod,
         Type       = "MOCK",
     });
     var myDemoDeployment = new Aws.ApiGateway.Deployment("myDemoDeployment", new Aws.ApiGateway.DeploymentArgs
     {
         RestApi   = myDemoAPI.Id,
         StageName = "test",
         Variables =
         {
             { "answer", "42" },
         },
     }, new CustomResourceOptions
     {
         DependsOn =
         {
             myDemoIntegration,
         },
     });
 }
예제 #14
0
 public MyStack()
 {
     var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
     {
         Description = "This is my API for demonstration purposes",
     });
     var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
     {
         ParentId = myDemoAPI.RootResourceId,
         PathPart = "mydemoresource",
         RestApi  = myDemoAPI.Id,
     });
     var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
     {
         Authorization = "NONE",
         HttpMethod    = "GET",
         ResourceId    = myDemoResource.Id,
         RestApi       = myDemoAPI.Id,
     });
 }
예제 #15
0
 public MyStack()
 {
     var main = new Aws.ApiGateway.RestApi("main", new Aws.ApiGateway.RestApiArgs
     {
     });
     var test = new Aws.ApiGateway.Response("test", new Aws.ApiGateway.ResponseArgs
     {
         ResponseParameters =
         {
             { "gatewayresponse.header.Authorization", "'Basic'" },
         },
         ResponseTemplates =
         {
             { "application/json", "{'message':$context.error.messageString}" },
         },
         ResponseType = "UNAUTHORIZED",
         RestApiId    = main.Id,
         StatusCode   = "401",
     });
 }