|
| 1 | +r""" |
| 2 | + This code was generated by |
| 3 | + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | +
|
| 7 | + Twilio - Messaging |
| 8 | + This is the public Twilio REST API. |
| 9 | +
|
| 10 | + NOTE: This class is auto generated by OpenAPI Generator. |
| 11 | + https://openapi-generator.tech |
| 12 | + Do not edit the class manually. |
| 13 | +""" |
| 14 | + |
| 15 | +from datetime import datetime |
| 16 | +from typing import Any, Dict, Optional |
| 17 | +from twilio.base import deserialize, values |
| 18 | +from twilio.base.instance_context import InstanceContext |
| 19 | +from twilio.base.instance_resource import InstanceResource |
| 20 | +from twilio.base.list_resource import ListResource |
| 21 | +from twilio.base.version import Version |
| 22 | + |
| 23 | + |
| 24 | +class RequestManagedCertInstance(InstanceResource): |
| 25 | + """ |
| 26 | + :ivar domain_sid: The unique string that we created to identify the Domain resource. |
| 27 | + :ivar date_updated: Date that this Domain was last updated. |
| 28 | + :ivar date_created: Date that this Domain was registered to the Twilio platform to create a new Domain object. |
| 29 | + :ivar date_expires: Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. |
| 30 | + :ivar domain_name: Full url path for this domain. |
| 31 | + :ivar certificate_sid: The unique string that we created to identify this Certificate resource. |
| 32 | + :ivar url: |
| 33 | + :ivar managed: A boolean flag indicating if the certificate is managed by Twilio. |
| 34 | + :ivar requesting: A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. |
| 35 | + """ |
| 36 | + |
| 37 | + def __init__( |
| 38 | + self, |
| 39 | + version: Version, |
| 40 | + payload: Dict[str, Any], |
| 41 | + domain_sid: Optional[str] = None, |
| 42 | + ): |
| 43 | + super().__init__(version) |
| 44 | + |
| 45 | + self.domain_sid: Optional[str] = payload.get("domain_
3270
sid") |
| 46 | + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( |
| 47 | + payload.get("date_updated") |
| 48 | + ) |
| 49 | + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( |
| 50 | + payload.get("date_created") |
| 51 | + ) |
| 52 | + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( |
| 53 | + payload.get("date_expires") |
| 54 | + ) |
| 55 | + self.domain_name: Optional[str] = payload.get("domain_name") |
| 56 | + self.certificate_sid: Optional[str] = payload.get("certificate_sid") |
| 57 | + self.url: Optional[str] = payload.get("url") |
| 58 | + self.managed: Optional[bool] = payload.get("managed") |
| 59 | + self.requesting: Optional[bool] = payload.get("requesting") |
| 60 | + |
| 61 | + self._solution = { |
| 62 | + "domain_sid": domain_sid or self.domain_sid, |
| 63 | + } |
| 64 | + self._context: Optional[RequestManagedCertContext] = None |
| 65 | + |
| 66 | + @property |
| 67 | + def _proxy(self) -> "RequestManagedCertContext": |
| 68 | + """ |
| 69 | + Generate an instance context for the instance, the context is capable of |
| 70 | + performing various actions. All instance actions are proxied to the context |
| 71 | +
|
| 72 | + :returns: RequestManagedCertContext for this RequestManagedCertInstance |
| 73 | + """ |
| 74 | + if self._context is None: |
| 75 | + self._context = RequestManagedCertContext( |
| 76 | + self._version, |
| 77 | + domain_sid=self._solution["domain_sid"], |
| 78 | + ) |
| 79 | + return self._context |
| 80 | + |
| 81 | + def update(self) -> "RequestManagedCertInstance": |
| 82 | + """ |
| 83 | + Update the RequestManagedCertInstance |
| 84 | +
|
| 85 | +
|
| 86 | + :returns: The updated RequestManagedCertInstance |
| 87 | + """ |
| 88 | + return self._proxy.update() |
| 89 | + |
| 90 | + async def update_async(self) -> "RequestManagedCertInstance": |
| 91 | + """ |
| 92 | + Asynchronous coroutine to update the RequestManagedCertInstance |
| 93 | +
|
| 94 | +
|
| 95 | + :returns: The updated RequestManagedCertInstance |
| 96 | + """ |
| 97 | + return await self._proxy.update_async() |
| 98 | + |
| 99 | + def __repr__(self) -> str: |
| 100 | + """ |
| 101 | + Provide a friendly representation |
| 102 | +
|
| 103 | + :returns: Machine friendly representation |
| 104 | + """ |
| 105 | + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) |
| 106 | + return "<Twilio.Messaging.V1.RequestManagedCertInstance {}>".format(context) |
| 107 | + |
| 108 | + |
| 109 | +class RequestManagedCertContext(InstanceContext): |
| 110 | + |
| 111 | + def __init__(self, version: Version, domain_sid: str): |
| 112 | + """ |
| 113 | + Initialize the RequestManagedCertContext |
| 114 | +
|
| 115 | + :param version: Version that contains the resource |
| 116 | + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. |
| 117 | + """ |
| 118 | + super().__init__(version) |
| 119 | + |
| 120 | + # Path Solution |
| 121 | + self._solution = { |
| 122 | + "domain_sid": domain_sid, |
| 123 | + } |
| 124 | + self._uri = "/LinkShortening/Domains/{domain_sid}/RequestManagedCert".format( |
| 125 | + **self._solution |
| 126 | + ) |
| 127 | + |
| 128 | + def update(self) -> RequestManagedCertInstance: |
| 129 | + """ |
| 130 | + Update the RequestManagedCertInstance |
| 131 | +
|
| 132 | +
|
| 133 | + :returns: The updated RequestManagedCertInstance |
| 134 | + """ |
| 135 | + data = values.of({}) |
| 136 | + |
| 137 | + payload = self._version.update( |
| 138 | + method="POST", |
| 139 | + uri=self._uri, |
| 140 | + data=data, |
| 141 | + ) |
| 142 | + |
| 143 | + return RequestManagedCertInstance( |
| 144 | + self._version, payload, domain_sid=self._solution["domain_sid"] |
| 145 | + ) |
| 146 | + |
| 147 | + async def update_async(self) -> RequestManagedCertInstance: |
| 148 | + """ |
| 149 | + Asynchronous coroutine to update the RequestManagedCertInstance |
| 150 | +
|
| 151 | +
|
| 152 | + :returns: The updated RequestManagedCertInstance |
| 153 | + """ |
| 154 | + data = values.of({}) |
| 155 | + |
| 156 | + payload = await self._version.update_async( |
| 157 | + method="POST", |
| 158 | + uri=self._uri, |
| 159 | + data=data, |
| 160 | + ) |
| 161 | + |
| 162 | + return RequestManagedCertInstance( |
| 163 | + self._version, payload, domain_sid=self._solution["domain_sid"] |
| 164 | + ) |
| 165 | + |
| 166 | + def __repr__(self) -> str: |
| 167 | + """ |
| 168 | + Provide a friendly representation |
| 169 | +
|
| 170 | + :returns: Machine friendly representation |
| 171 | + """ |
| 172 | + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) |
| 173 | + return "<Twilio.Messaging.V1.RequestManagedCertContext {}>".format(context) |
| 174 | + |
| 175 | + |
| 176 | +class RequestManagedCertList(ListResource): |
| 177 | + |
| 178 | + def __init__(self, version: Version): |
| 179 | + """ |
| 180 | + Initialize the RequestManagedCertList |
| 181 | +
|
| 182 | + :param version: Version that contains the resource |
| 183 | +
|
| 184 | + """ |
| 185 | + super().__init__(version) |
| 186 | + |
| 187 | + def get(self, domain_sid: str) -> RequestManagedCertContext: |
| 188 | + """ |
| 189 | + Constructs a RequestManagedCertContext |
| 190 | +
|
| 191 | + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. |
| 192 | + """ |
| 193 | + return RequestManagedCertContext(self._version, domain_sid=domain_sid) |
| 194 | + |
| 195 | + def __call__(self, domain_sid: str) -> RequestManagedCertContext: |
| 196 | + """ |
| 197 | + Constructs a RequestManagedCertContext |
| 198 | +
|
| 199 | + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. |
| 200 | + """ |
| 201 | + return RequestManagedCertContext(self._version, domain_sid=domain_sid) |
| 202 | + |
| 203 | + def __repr__(self) -> str: |
| 204 | + """ |
| 205 | + Provide a friendly representation |
| 206 | +
|
| 207 | + :returns: Machine friendly representation |
| 208 | + """ |
| 209 | + return "<Twilio.Messaging.V1.RequestManagedCertList>" |
0 commit comments