Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
],
"nhsd-prod": ["dev", "int", "sandbox", "prod"],
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AddJwksResourceUrlToApp(pydantic.BaseModel):
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
"dev",
"int",
"sandbox",
Expand All @@ -56,11 +57,10 @@ def check_org_env_combo(cls, environment, values):
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
]
if org == "nhsd-nonprod" and environment not in non_prod_envs:
raise ValueError(
f"Invalid environment {environment} for organization {org}"
)
raise ValueError(f"Invalid environment {environment} for organization {org}")
return environment

@pydantic.validator("environment")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
"dev",
"sandbox",
"int",
Expand All @@ -35,9 +36,7 @@ class ApigeeProductAttributeRateLimiting(BaseModel):
value: Union[Dict[str, RateLimitingConfig], str]

@validator("value")
def validate_ratelimiting(
cls, ratelimiting: Union[Dict[str, RateLimitingConfig], str]
) -> str:
def validate_ratelimiting(cls, ratelimiting: Union[Dict[str, RateLimitingConfig], str]) -> str:
"""
Apigee API requires a string. We decode it as JSON in the
shared flow.
Expand Down Expand Up @@ -110,36 +109,39 @@ def _literal_name(class_):
+ ")$)"
)


class ApigeeProductAttributeOther(BaseModel):
name: constr(regex=PRODUCT_ATTRIBUTE_REGEX)
value: str


ApigeeProductAttributeSpecial = Annotated[
Union [
Union[
ApigeeProductAttributeAccess,
ApigeeProductAttributeRateLimit,
ApigeeProductAttributeRateLimiting,
],
Field(discriminator="name")
Field(discriminator="name"),
]


def _count_cls(items: List[Any], cls: Type):
return sum(isinstance(item, cls) for item in items)


class ApigeeProduct(BaseModel):
name: str
approvalType: Literal["auto", "manual"] = "manual"
attributes: List[Union[ApigeeProductAttributeSpecial, ApigeeProductAttributeOther]] = [{"name": "access", "value": "private"}]
attributes: List[Union[ApigeeProductAttributeSpecial, ApigeeProductAttributeOther]] = [
{"name": "access", "value": "private"}
]
description: str = None
displayName: str = None

# Note: This value is manually inserted by apigee_environment
# object that contains this product. So if you do not provide a
# value in the manifest file it is still populated.
environments: conlist(
item_type=LITERAL_APIGEE_ENVIRONMENTS, min_items=1, max_items=1
)
environments: conlist(item_type=LITERAL_APIGEE_ENVIRONMENTS, min_items=1, max_items=1)
proxies: List[str] = []
quota: constr(regex=r"[1-9][0-9]*") = None
quotaInterval: constr(regex=r"[1-9][0-9]*") = None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
APIGEE_ORGANIZATIONS: [nhsd-nonprod, nhsd-prod]
APIGEE_ENVIRONMENTS:
nhsd-nonprod: [internal-dev, internal-dev-sandbox, internal-qa, internal-qa-sandbox, ref]
nhsd-nonprod:
[
internal-dev,
internal-dev-sandbox,
internal-qa,
internal-qa-sandbox,
ref,
res,
]
nhsd-prod: [dev, sandbox, int, prod]

APIGEE_ENVIRONMENT: "{{ lookup('env','APIGEE_ENVIRONMENT') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@
"const": "ref",
"type": "string"
},
{
"const": "res",
"type": "string"
},
{
"const": "dev",
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
"dev",
"sandbox",
"int",
Expand Down Expand Up @@ -371,6 +372,7 @@
"internal-qa",
"internal-qa-sandbox",
"ref",
"res",
"dev",
"sandbox",
"int",
Expand Down
Loading
Loading