Add policy to apigateway
This commit is contained in:
parent
eb17288503
commit
a658900d69
@ -461,6 +461,7 @@ class RestAPI(BaseModel):
|
|||||||
self.description = description
|
self.description = description
|
||||||
self.create_date = int(time.time())
|
self.create_date = int(time.time())
|
||||||
self.api_key_source = kwargs.get("api_key_source") or "HEADER"
|
self.api_key_source = kwargs.get("api_key_source") or "HEADER"
|
||||||
|
self.policy = kwargs.get("policy") or None
|
||||||
self.endpoint_configuration = kwargs.get("endpoint_configuration") or {
|
self.endpoint_configuration = kwargs.get("endpoint_configuration") or {
|
||||||
"types": ["EDGE"]
|
"types": ["EDGE"]
|
||||||
}
|
}
|
||||||
@ -485,6 +486,7 @@ class RestAPI(BaseModel):
|
|||||||
"apiKeySource": self.api_key_source,
|
"apiKeySource": self.api_key_source,
|
||||||
"endpointConfiguration": self.endpoint_configuration,
|
"endpointConfiguration": self.endpoint_configuration,
|
||||||
"tags": self.tags,
|
"tags": self.tags,
|
||||||
|
"policy": self.policy,
|
||||||
}
|
}
|
||||||
|
|
||||||
def add_child(self, path, parent_id=None):
|
def add_child(self, path, parent_id=None):
|
||||||
@ -713,6 +715,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
api_key_source=None,
|
api_key_source=None,
|
||||||
endpoint_configuration=None,
|
endpoint_configuration=None,
|
||||||
tags=None,
|
tags=None,
|
||||||
|
policy=None,
|
||||||
):
|
):
|
||||||
api_id = create_id()
|
api_id = create_id()
|
||||||
rest_api = RestAPI(
|
rest_api = RestAPI(
|
||||||
@ -723,6 +726,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
api_key_source=api_key_source,
|
api_key_source=api_key_source,
|
||||||
endpoint_configuration=endpoint_configuration,
|
endpoint_configuration=endpoint_configuration,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
policy=policy,
|
||||||
)
|
)
|
||||||
self.apis[api_id] = rest_api
|
self.apis[api_id] = rest_api
|
||||||
return rest_api
|
return rest_api
|
||||||
|
@ -59,6 +59,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
api_key_source = self._get_param("apiKeySource")
|
api_key_source = self._get_param("apiKeySource")
|
||||||
endpoint_configuration = self._get_param("endpointConfiguration")
|
endpoint_configuration = self._get_param("endpointConfiguration")
|
||||||
tags = self._get_param("tags")
|
tags = self._get_param("tags")
|
||||||
|
policy = self._get_param("policy")
|
||||||
|
|
||||||
# Param validation
|
# Param validation
|
||||||
if api_key_source and api_key_source not in API_KEY_SOURCES:
|
if api_key_source and api_key_source not in API_KEY_SOURCES:
|
||||||
@ -94,6 +95,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
api_key_source=api_key_source,
|
api_key_source=api_key_source,
|
||||||
endpoint_configuration=endpoint_configuration,
|
endpoint_configuration=endpoint_configuration,
|
||||||
tags=tags,
|
tags=tags,
|
||||||
|
policy=policy,
|
||||||
)
|
)
|
||||||
return 200, {}, json.dumps(rest_api.to_dict())
|
return 200, {}, json.dumps(rest_api.to_dict())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user