-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from fiaas/custom-resource-definitions
Custom resource definitions
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 | ||
from __future__ import absolute_import | ||
|
||
import datetime | ||
|
||
import six | ||
|
||
from .common import ObjectMeta | ||
from ..base import Model | ||
from ..fields import Field, ListField | ||
|
||
|
||
class CustomResourceDefinitionNames(Model): | ||
kind = Field(six.text_type) | ||
listKind = Field(six.text_type) | ||
plural = Field(six.text_type) | ||
shortNames = ListField(six.text_type) | ||
singular = Field(six.text_type) | ||
|
||
|
||
class CustomResourceValidation(Model): | ||
# This field is fully defined in the API Reference, but in essence it is simply a JSON-schema | ||
# following Specification Draft 4 (http://json-schema.org/) | ||
openAPIV3Schema = Field(dict) | ||
|
||
|
||
class CustomResourceDefinitionSpec(Model): | ||
group = Field(six.text_type) | ||
names = Field(CustomResourceDefinitionNames) | ||
scope = Field(six.text_type) | ||
validation = Field(CustomResourceValidation) | ||
version = Field(six.text_type) | ||
|
||
|
||
class CustomResourceDefinitionCondition(Model): | ||
lastTransitionTime = Field(datetime.datetime) | ||
message = Field(six.text_type) | ||
reason = Field(six.text_type) | ||
status = Field(six.text_type) | ||
type = Field(six.text_type) | ||
|
||
|
||
class CustomResourceDefinitionStatus(Model): | ||
acceptedNames = Field(CustomResourceDefinitionNames) | ||
conditions = ListField(CustomResourceDefinitionCondition) | ||
|
||
|
||
class CustomResourceDefinition(Model): | ||
class Meta: | ||
url_template = "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/{name}" | ||
watch_list_url = "/apis/apiextensions.k8s.io/v1beta1/watch/customresourcedefinitions" | ||
|
||
metadata = Field(ObjectMeta) | ||
spec = Field(CustomResourceDefinitionSpec) | ||
status = Field(CustomResourceDefinitionStatus) |