|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Resource Manager API |
| 5 | +
|
| 6 | + API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 2.0 |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +"""# noqa: E501 |
| 13 | + |
| 14 | +from __future__importannotations |
| 15 | + |
| 16 | +importjson |
| 17 | +importpprint |
| 18 | +fromtypingimportAny,ClassVar,Dict,List,Optional,Set |
| 19 | + |
| 20 | +frompydanticimportBaseModel,ConfigDict,Field,StrictStr,field_validator |
| 21 | +fromtyping_extensionsimportSelf |
| 22 | + |
| 23 | +fromstackit.resourcemanager.models.lifecycle_stateimportLifecycleState |
| 24 | + |
| 25 | + |
| 26 | +classContainerSearchResult(BaseModel): |
| 27 | +""" |
| 28 | + ContainerSearchResult |
| 29 | + """# noqa: E501 |
| 30 | + |
| 31 | +container_id:StrictStr=Field(description="Globally unique user-friendly identifier.",alias="containerId") |
| 32 | +container_type:StrictStr=Field(description="Resource container type.",alias="containerType") |
| 33 | +id:StrictStr=Field(description="Globally unique identifier.") |
| 34 | +lifecycle_state:Optional[LifecycleState]=Field(default=None,alias="lifecycleState") |
| 35 | +name:StrictStr=Field(description="Resource container name.") |
| 36 | +organization_id:Optional[StrictStr]=Field( |
| 37 | +default=None,description="Id of the organization the container is in.",alias="organizationId" |
| 38 | + ) |
| 39 | +__properties:ClassVar[List[str]]= [ |
| 40 | +"containerId", |
| 41 | +"containerType", |
| 42 | +"id", |
| 43 | +"lifecycleState", |
| 44 | +"name", |
| 45 | +"organizationId", |
| 46 | + ] |
| 47 | + |
| 48 | +@field_validator("container_type") |
| 49 | +defcontainer_type_validate_enum(cls,value): |
| 50 | +"""Validates the enum""" |
| 51 | +ifvaluenotinset(["PROJECT","FOLDER"]): |
| 52 | +raiseValueError("must be one of enum values ('PROJECT', 'FOLDER')") |
| 53 | +returnvalue |
| 54 | + |
| 55 | +model_config=ConfigDict( |
| 56 | +populate_by_name=True, |
| 57 | +validate_assignment=True, |
| 58 | +protected_namespaces=(), |
| 59 | + ) |
| 60 | + |
| 61 | +defto_str(self)->str: |
| 62 | +"""Returns the string representation of the model using alias""" |
| 63 | +returnpprint.pformat(self.model_dump(by_alias=True)) |
| 64 | + |
| 65 | +defto_json(self)->str: |
| 66 | +"""Returns the JSON representation of the model using alias""" |
| 67 | +# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead |
| 68 | +returnjson.dumps(self.to_dict()) |
| 69 | + |
| 70 | +@classmethod |
| 71 | +deffrom_json(cls,json_str:str)->Optional[Self]: |
| 72 | +"""Create an instance of ContainerSearchResult from a JSON string""" |
| 73 | +returncls.from_dict(json.loads(json_str)) |
| 74 | + |
| 75 | +defto_dict(self)->Dict[str,Any]: |
| 76 | +"""Return the dictionary representation of the model using alias. |
| 77 | +
|
| 78 | + This has the following differences from calling pydantic's |
| 79 | + `self.model_dump(by_alias=True)`: |
| 80 | +
|
| 81 | + * `None` is only added to the output dict for nullable fields that |
| 82 | + were set at model initialization. Other fields with value `None` |
| 83 | + are ignored. |
| 84 | + """ |
| 85 | +excluded_fields:Set[str]=set([]) |
| 86 | + |
| 87 | +_dict=self.model_dump( |
| 88 | +by_alias=True, |
| 89 | +exclude=excluded_fields, |
| 90 | +exclude_none=True, |
| 91 | + ) |
| 92 | +return_dict |
| 93 | + |
| 94 | +@classmethod |
| 95 | +deffrom_dict(cls,obj:Optional[Dict[str,Any]])->Optional[Self]: |
| 96 | +"""Create an instance of ContainerSearchResult from a dict""" |
| 97 | +ifobjisNone: |
| 98 | +returnNone |
| 99 | + |
| 100 | +ifnotisinstance(obj,dict): |
| 101 | +returncls.model_validate(obj) |
| 102 | + |
| 103 | +_obj=cls.model_validate( |
| 104 | + { |
| 105 | +"containerId":obj.get("containerId"), |
| 106 | +"containerType":obj.get("containerType"), |
| 107 | +"id":obj.get("id"), |
| 108 | +"lifecycleState":obj.get("lifecycleState"), |
| 109 | +"name":obj.get("name"), |
| 110 | +"organizationId":obj.get("organizationId"), |
| 111 | + } |
| 112 | + ) |
| 113 | +return_obj |