diff --git a/docs/ambassador2.md b/docs/ambassador2.md index 743ea0e..937f53f 100644 --- a/docs/ambassador2.md +++ b/docs/ambassador2.md @@ -26,7 +26,7 @@ Flags: -h, --help ``` -The Ambassador generator generates [AmbassadorMapping]s (https://www.getambassador.io/docs/edge-stack/2.0/topics/using/intro-mappings/) resources for mapping resource to services. All options that can be set via +The Ambassador generator generates [Mapping]s (https://www.getambassador.io/docs/edge-stack/2.0/topics/using/intro-mappings/) resources for mapping resource to services. All options that can be set via flags can also be set using our `x-kusk` OpenAPI extension in your specification. CLI flags apply only at the global level i.e. applies to all paths and methods. @@ -44,7 +44,7 @@ To override settings on the path or HTTP method level, you are required to use t | Path Base | --path.base | path.base | Prefix for your resource routes | ❌ | | Path Trim Prefix | --path.trim_prefix | path.trim_prefix | Trim the specified prefix from URl before passing request onto service | ❌ | | Path split | --path.split | path.split | Boolean; whether or not to force generator to generate a mapping for each path | ❌ | -| Host | --host | host | The value to set the host field to in the AmbassadorMapping resource | ✅ | +| Host | --host | host | The value to set the host field to in the Mapping resource | ✅ | | Rate limit (RPS) | --rate_limits.rps | rate_limits.rps | Request per second rate limit | ✅ | | Rate limit (burst) | --rate_limits.burst | rate_limits.burst | Rate limit burst | ✅ | | Rate limit group | N/A | rate_limits.group | Rate limit endpoint group | | @@ -167,7 +167,7 @@ paths: ```yaml --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: booksapp namespace: booksapp @@ -228,7 +228,7 @@ paths: ```yaml --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: booksapp-get namespace: booksapp @@ -240,7 +240,7 @@ spec: rewrite: "" --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: booksapp-postbooks namespace: booksapp @@ -304,7 +304,7 @@ paths: ```yaml --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: booksapp namespace: booksapp @@ -368,7 +368,7 @@ paths: ```yaml --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: booksapp namespace: booksapp @@ -426,7 +426,7 @@ paths: ```yaml --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: webapp namespace: booksapp @@ -505,7 +505,7 @@ paths: ```yaml ---- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: webapp-get namespace: booksapp @@ -528,7 +528,7 @@ spec: max_age: "86400" --- apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +kind: Mapping metadata: name: webapp-postbooks namespace: booksapp diff --git a/generators/ambassador/v2/ambassador_test.go b/generators/ambassador/v2/ambassador_test.go index 8124cf0..be9ffdc 100644 --- a/generators/ambassador/v2/ambassador_test.go +++ b/generators/ambassador/v2/ambassador_test.go @@ -59,8 +59,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -110,8 +110,8 @@ spec: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -153,8 +153,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: amb @@ -204,8 +204,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -255,8 +255,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-postpetpetiduploadimage namespace: default @@ -306,8 +306,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-postpetpetiduploadimage namespace: default @@ -363,8 +363,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore namespace: default @@ -412,8 +412,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-postpetpetiduploadimage namespace: default @@ -528,8 +528,8 @@ definitions: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-createpets namespace: default @@ -540,8 +540,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-listpets namespace: default @@ -552,8 +552,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-showpetbyid namespace: default @@ -709,8 +709,8 @@ spec: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-createpets namespace: default @@ -721,8 +721,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-listpets namespace: default @@ -733,8 +733,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-showpetbyid namespace: default @@ -778,8 +778,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -822,8 +822,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -880,8 +880,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -939,8 +939,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -999,8 +999,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore namespace: default @@ -1087,8 +1087,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -1112,8 +1112,8 @@ spec: max_age: "240" timeout_ms: 5000 --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -1184,8 +1184,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore namespace: default @@ -1248,8 +1248,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -1262,8 +1262,8 @@ spec: timeout_ms: 35000 idle_timeout_ms: 36000 --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -1308,8 +1308,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore namespace: default @@ -1362,8 +1362,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore namespace: default @@ -1444,8 +1444,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -1462,8 +1462,8 @@ spec: - request: - remote-address --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -1562,8 +1562,8 @@ paths: description: Successful operation`, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-updatepet namespace: default @@ -1580,8 +1580,8 @@ spec: - request: - remote-address --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-uploadfile namespace: default @@ -1676,8 +1676,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-get namespace: default @@ -1729,8 +1729,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-patch namespace: default @@ -1741,8 +1741,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-post namespace: default @@ -1784,8 +1784,8 @@ paths: `, res: ` --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-patch namespace: default @@ -1796,8 +1796,8 @@ spec: service: petstore.default:80 rewrite: "" --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: petstore-post namespace: default @@ -1825,9 +1825,9 @@ spec: spec, err := spec.NewParser(openapi3.NewLoader()).ParseFromReader(strings.NewReader(testCase.spec)) r.NoError(err, "failed to parse spec") - AmbassadorMappings, err := gen.Generate(&testCase.options, spec) + Mappings, err := gen.Generate(&testCase.options, spec) r.NoError(err) - r.Equal(testCase.res, AmbassadorMappings) + r.Equal(testCase.res, Mappings) }) } } diff --git a/generators/ambassador/v2/mapping_template.go b/generators/ambassador/v2/mapping_template.go index 459bc69..6be46c8 100644 --- a/generators/ambassador/v2/mapping_template.go +++ b/generators/ambassador/v2/mapping_template.go @@ -2,8 +2,8 @@ package v2 var mappingTemplateRaw = `{{range .}} --- -apiVersion: x.getambassador.io/v3alpha1 -kind: AmbassadorMapping +apiVersion: getambassador.io/v3alpha1 +kind: Mapping metadata: name: {{.MappingName}} namespace: {{.MappingNamespace}}