databricks-sdk 0.65.0__py3-none-any.whl → 0.67.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of databricks-sdk might be problematic. Click here for more details.

@@ -263,6 +263,9 @@ class GenieAttachment:
263
263
  query: Optional[GenieQueryAttachment] = None
264
264
  """Query Attachment if Genie responds with a SQL query"""
265
265
 
266
+ suggested_questions: Optional[GenieSuggestedQuestionsAttachment] = None
267
+ """Follow-up questions suggested by Genie"""
268
+
266
269
  text: Optional[TextAttachment] = None
267
270
  """Text Attachment if Genie responds with text"""
268
271
 
@@ -273,6 +276,8 @@ class GenieAttachment:
273
276
  body["attachment_id"] = self.attachment_id
274
277
  if self.query:
275
278
  body["query"] = self.query.as_dict()
279
+ if self.suggested_questions:
280
+ body["suggested_questions"] = self.suggested_questions.as_dict()
276
281
  if self.text:
277
282
  body["text"] = self.text.as_dict()
278
283
  return body
@@ -284,6 +289,8 @@ class GenieAttachment:
284
289
  body["attachment_id"] = self.attachment_id
285
290
  if self.query:
286
291
  body["query"] = self.query
292
+ if self.suggested_questions:
293
+ body["suggested_questions"] = self.suggested_questions
287
294
  if self.text:
288
295
  body["text"] = self.text
289
296
  return body
@@ -294,6 +301,7 @@ class GenieAttachment:
294
301
  return cls(
295
302
  attachment_id=d.get("attachment_id", None),
296
303
  query=_from_dict(d, "query", GenieQueryAttachment),
304
+ suggested_questions=_from_dict(d, "suggested_questions", GenieSuggestedQuestionsAttachment),
297
305
  text=_from_dict(d, "text", TextAttachment),
298
306
  )
299
307
 
@@ -413,6 +421,33 @@ class GenieConversationSummary:
413
421
  )
414
422
 
415
423
 
424
+ @dataclass
425
+ class GenieFeedback:
426
+ """Feedback containing rating and optional comment"""
427
+
428
+ rating: Optional[GenieFeedbackRating] = None
429
+ """The feedback rating"""
430
+
431
+ def as_dict(self) -> dict:
432
+ """Serializes the GenieFeedback into a dictionary suitable for use as a JSON request body."""
433
+ body = {}
434
+ if self.rating is not None:
435
+ body["rating"] = self.rating.value
436
+ return body
437
+
438
+ def as_shallow_dict(self) -> dict:
439
+ """Serializes the GenieFeedback into a shallow dictionary of its immediate attributes."""
440
+ body = {}
441
+ if self.rating is not None:
442
+ body["rating"] = self.rating
443
+ return body
444
+
445
+ @classmethod
446
+ def from_dict(cls, d: Dict[str, Any]) -> GenieFeedback:
447
+ """Deserializes the GenieFeedback from a dictionary."""
448
+ return cls(rating=_enum(d, "rating", GenieFeedbackRating))
449
+
450
+
416
451
  class GenieFeedbackRating(Enum):
417
452
  """Feedback rating for Genie messages"""
418
453
 
@@ -572,6 +607,9 @@ class GenieMessage:
572
607
  error: Optional[MessageError] = None
573
608
  """Error message if Genie failed to respond to the message"""
574
609
 
610
+ feedback: Optional[GenieFeedback] = None
611
+ """User feedback for the message if provided"""
612
+
575
613
  last_updated_timestamp: Optional[int] = None
576
614
  """Timestamp when the message was last updated"""
577
615
 
@@ -597,6 +635,8 @@ class GenieMessage:
597
635
  body["created_timestamp"] = self.created_timestamp
598
636
  if self.error:
599
637
  body["error"] = self.error.as_dict()
638
+ if self.feedback:
639
+ body["feedback"] = self.feedback.as_dict()
600
640
  if self.id is not None:
601
641
  body["id"] = self.id
602
642
  if self.last_updated_timestamp is not None:
@@ -626,6 +666,8 @@ class GenieMessage:
626
666
  body["created_timestamp"] = self.created_timestamp
627
667
  if self.error:
628
668
  body["error"] = self.error
669
+ if self.feedback:
670
+ body["feedback"] = self.feedback
629
671
  if self.id is not None:
630
672
  body["id"] = self.id
631
673
  if self.last_updated_timestamp is not None:
@@ -651,6 +693,7 @@ class GenieMessage:
651
693
  conversation_id=d.get("conversation_id", None),
652
694
  created_timestamp=d.get("created_timestamp", None),
653
695
  error=_from_dict(d, "error", MessageError),
696
+ feedback=_from_dict(d, "feedback", GenieFeedback),
654
697
  id=d.get("id", None),
655
698
  last_updated_timestamp=d.get("last_updated_timestamp", None),
656
699
  message_id=d.get("message_id", None),
@@ -671,6 +714,8 @@ class GenieQueryAttachment:
671
714
  last_updated_timestamp: Optional[int] = None
672
715
  """Time when the user updated the query last"""
673
716
 
717
+ parameters: Optional[List[QueryAttachmentParameter]] = None
718
+
674
719
  query: Optional[str] = None
675
720
  """AI generated SQL query"""
676
721
 
@@ -693,6 +738,8 @@ class GenieQueryAttachment:
693
738
  body["id"] = self.id
694
739
  if self.last_updated_timestamp is not None:
695
740
  body["last_updated_timestamp"] = self.last_updated_timestamp
741
+ if self.parameters:
742
+ body["parameters"] = [v.as_dict() for v in self.parameters]
696
743
  if self.query is not None:
697
744
  body["query"] = self.query
698
745
  if self.query_result_metadata:
@@ -712,6 +759,8 @@ class GenieQueryAttachment:
712
759
  body["id"] = self.id
713
760
  if self.last_updated_timestamp is not None:
714
761
  body["last_updated_timestamp"] = self.last_updated_timestamp
762
+ if self.parameters:
763
+ body["parameters"] = self.parameters
715
764
  if self.query is not None:
716
765
  body["query"] = self.query
717
766
  if self.query_result_metadata:
@@ -729,6 +778,7 @@ class GenieQueryAttachment:
729
778
  description=d.get("description", None),
730
779
  id=d.get("id", None),
731
780
  last_updated_timestamp=d.get("last_updated_timestamp", None),
781
+ parameters=_repeated_dict(d, "parameters", QueryAttachmentParameter),
732
782
  query=d.get("query", None),
733
783
  query_result_metadata=_from_dict(d, "query_result_metadata", GenieResultMetadata),
734
784
  statement_id=d.get("statement_id", None),
@@ -779,6 +829,9 @@ class GenieSpace:
779
829
  description: Optional[str] = None
780
830
  """Description of the Genie Space"""
781
831
 
832
+ warehouse_id: Optional[str] = None
833
+ """Warehouse associated with the Genie Space"""
834
+
782
835
  def as_dict(self) -> dict:
783
836
  """Serializes the GenieSpace into a dictionary suitable for use as a JSON request body."""
784
837
  body = {}
@@ -788,6 +841,8 @@ class GenieSpace:
788
841
  body["space_id"] = self.space_id
789
842
  if self.title is not None:
790
843
  body["title"] = self.title
844
+ if self.warehouse_id is not None:
845
+ body["warehouse_id"] = self.warehouse_id
791
846
  return body
792
847
 
793
848
  def as_shallow_dict(self) -> dict:
@@ -799,12 +854,19 @@ class GenieSpace:
799
854
  body["space_id"] = self.space_id
800
855
  if self.title is not None:
801
856
  body["title"] = self.title
857
+ if self.warehouse_id is not None:
858
+ body["warehouse_id"] = self.warehouse_id
802
859
  return body
803
860
 
804
861
  @classmethod
805
862
  def from_dict(cls, d: Dict[str, Any]) -> GenieSpace:
806
863
  """Deserializes the GenieSpace from a dictionary."""
807
- return cls(description=d.get("description", None), space_id=d.get("space_id", None), title=d.get("title", None))
864
+ return cls(
865
+ description=d.get("description", None),
866
+ space_id=d.get("space_id", None),
867
+ title=d.get("title", None),
868
+ warehouse_id=d.get("warehouse_id", None),
869
+ )
808
870
 
809
871
 
810
872
  @dataclass
@@ -856,6 +918,33 @@ class GenieStartConversationResponse:
856
918
  )
857
919
 
858
920
 
921
+ @dataclass
922
+ class GenieSuggestedQuestionsAttachment:
923
+ """Follow-up questions suggested by Genie"""
924
+
925
+ questions: Optional[List[str]] = None
926
+ """The suggested follow-up questions"""
927
+
928
+ def as_dict(self) -> dict:
929
+ """Serializes the GenieSuggestedQuestionsAttachment into a dictionary suitable for use as a JSON request body."""
930
+ body = {}
931
+ if self.questions:
932
+ body["questions"] = [v for v in self.questions]
933
+ return body
934
+
935
+ def as_shallow_dict(self) -> dict:
936
+ """Serializes the GenieSuggestedQuestionsAttachment into a shallow dictionary of its immediate attributes."""
937
+ body = {}
938
+ if self.questions:
939
+ body["questions"] = self.questions
940
+ return body
941
+
942
+ @classmethod
943
+ def from_dict(cls, d: Dict[str, Any]) -> GenieSuggestedQuestionsAttachment:
944
+ """Deserializes the GenieSuggestedQuestionsAttachment from a dictionary."""
945
+ return cls(questions=d.get("questions", None))
946
+
947
+
859
948
  @dataclass
860
949
  class GetPublishedDashboardTokenInfoResponse:
861
950
  authorization_details: Optional[List[AuthorizationDetails]] = None
@@ -1053,6 +1142,7 @@ class MessageErrorType(Enum):
1053
1142
  DESCRIBE_QUERY_INVALID_SQL_ERROR = "DESCRIBE_QUERY_INVALID_SQL_ERROR"
1054
1143
  DESCRIBE_QUERY_TIMEOUT = "DESCRIBE_QUERY_TIMEOUT"
1055
1144
  DESCRIBE_QUERY_UNEXPECTED_FAILURE = "DESCRIBE_QUERY_UNEXPECTED_FAILURE"
1145
+ EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION = "EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION"
1056
1146
  FUNCTIONS_NOT_AVAILABLE_EXCEPTION = "FUNCTIONS_NOT_AVAILABLE_EXCEPTION"
1057
1147
  FUNCTION_ARGUMENTS_INVALID_EXCEPTION = "FUNCTION_ARGUMENTS_INVALID_EXCEPTION"
1058
1148
  FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION = "FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION"
@@ -1063,6 +1153,8 @@ class MessageErrorType(Enum):
1063
1153
  GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION = "GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION"
1064
1154
  GENERIC_SQL_EXEC_API_CALL_EXCEPTION = "GENERIC_SQL_EXEC_API_CALL_EXCEPTION"
1065
1155
  ILLEGAL_PARAMETER_DEFINITION_EXCEPTION = "ILLEGAL_PARAMETER_DEFINITION_EXCEPTION"
1156
+ INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION = "INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION"
1157
+ INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION = "INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION"
1066
1158
  INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION = "INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION"
1067
1159
  INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION = "INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION"
1068
1160
  INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION = "INVALID_CHAT_COMPLETION_ARGUMENTS_JSON_EXCEPTION"
@@ -1176,6 +1268,42 @@ class PublishedDashboard:
1176
1268
  )
1177
1269
 
1178
1270
 
1271
+ @dataclass
1272
+ class QueryAttachmentParameter:
1273
+ keyword: Optional[str] = None
1274
+
1275
+ sql_type: Optional[str] = None
1276
+
1277
+ value: Optional[str] = None
1278
+
1279
+ def as_dict(self) -> dict:
1280
+ """Serializes the QueryAttachmentParameter into a dictionary suitable for use as a JSON request body."""
1281
+ body = {}
1282
+ if self.keyword is not None:
1283
+ body["keyword"] = self.keyword
1284
+ if self.sql_type is not None:
1285
+ body["sql_type"] = self.sql_type
1286
+ if self.value is not None:
1287
+ body["value"] = self.value
1288
+ return body
1289
+
1290
+ def as_shallow_dict(self) -> dict:
1291
+ """Serializes the QueryAttachmentParameter into a shallow dictionary of its immediate attributes."""
1292
+ body = {}
1293
+ if self.keyword is not None:
1294
+ body["keyword"] = self.keyword
1295
+ if self.sql_type is not None:
1296
+ body["sql_type"] = self.sql_type
1297
+ if self.value is not None:
1298
+ body["value"] = self.value
1299
+ return body
1300
+
1301
+ @classmethod
1302
+ def from_dict(cls, d: Dict[str, Any]) -> QueryAttachmentParameter:
1303
+ """Deserializes the QueryAttachmentParameter from a dictionary."""
1304
+ return cls(keyword=d.get("keyword", None), sql_type=d.get("sql_type", None), value=d.get("value", None))
1305
+
1306
+
1179
1307
  @dataclass
1180
1308
  class Result:
1181
1309
  is_truncated: Optional[bool] = None
@@ -1921,8 +2049,8 @@ class GenieAPI:
1921
2049
  :param space_id: str
1922
2050
  The ID of the Genie space to retrieve conversations from.
1923
2051
  :param include_all: bool (optional)
1924
- Include all conversations in the space across all users. Requires "Can Manage" permission on the
1925
- space.
2052
+ Include all conversations in the space across all users. Requires at least CAN MANAGE permission on
2053
+ the space.
1926
2054
  :param page_size: int (optional)
1927
2055
  Maximum number of conversations to return per page
1928
2056
  :param page_token: str (optional)
@@ -1970,15 +2098,7 @@ class GenieAPI:
1970
2098
  res = self._api.do("GET", "/api/2.0/genie/spaces", query=query, headers=headers)
1971
2099
  return GenieListSpacesResponse.from_dict(res)
1972
2100
 
1973
- def send_message_feedback(
1974
- self,
1975
- space_id: str,
1976
- conversation_id: str,
1977
- message_id: str,
1978
- rating: GenieFeedbackRating,
1979
- *,
1980
- comment: Optional[str] = None,
1981
- ):
2101
+ def send_message_feedback(self, space_id: str, conversation_id: str, message_id: str, rating: GenieFeedbackRating):
1982
2102
  """Send feedback for a message.
1983
2103
 
1984
2104
  :param space_id: str
@@ -1989,14 +2109,10 @@ class GenieAPI:
1989
2109
  The ID associated with the message to provide feedback for.
1990
2110
  :param rating: :class:`GenieFeedbackRating`
1991
2111
  The rating (POSITIVE, NEGATIVE, or NONE).
1992
- :param comment: str (optional)
1993
- Optional text feedback that will be stored as a comment.
1994
2112
 
1995
2113
 
1996
2114
  """
1997
2115
  body = {}
1998
- if comment is not None:
1999
- body["comment"] = comment
2000
2116
  if rating is not None:
2001
2117
  body["rating"] = rating.value
2002
2118
  headers = {
@@ -18,6 +18,38 @@ _LOG = logging.getLogger("databricks.sdk")
18
18
  # all definitions in this file are in alphabetical order
19
19
 
20
20
 
21
+ @dataclass
22
+ class CustomTag:
23
+ key: Optional[str] = None
24
+ """The key of the custom tag."""
25
+
26
+ value: Optional[str] = None
27
+ """The value of the custom tag."""
28
+
29
+ def as_dict(self) -> dict:
30
+ """Serializes the CustomTag into a dictionary suitable for use as a JSON request body."""
31
+ body = {}
32
+ if self.key is not None:
33
+ body["key"] = self.key
34
+ if self.value is not None:
35
+ body["value"] = self.value
36
+ return body
37
+
38
+ def as_shallow_dict(self) -> dict:
39
+ """Serializes the CustomTag into a shallow dictionary of its immediate attributes."""
40
+ body = {}
41
+ if self.key is not None:
42
+ body["key"] = self.key
43
+ if self.value is not None:
44
+ body["value"] = self.value
45
+ return body
46
+
47
+ @classmethod
48
+ def from_dict(cls, d: Dict[str, Any]) -> CustomTag:
49
+ """Deserializes the CustomTag from a dictionary."""
50
+ return cls(key=d.get("key", None), value=d.get("value", None))
51
+
52
+
21
53
  @dataclass
22
54
  class DatabaseCatalog:
23
55
  name: str
@@ -125,48 +157,46 @@ class DatabaseInstance:
125
157
  creator: Optional[str] = None
126
158
  """The email of the creator of the instance."""
127
159
 
160
+ custom_tags: Optional[List[CustomTag]] = None
161
+ """Custom tags associated with the instance. This field is only included on create and update
162
+ responses."""
163
+
164
+ effective_capacity: Optional[str] = None
165
+ """Deprecated. The sku of the instance; this field will always match the value of capacity."""
166
+
167
+ effective_custom_tags: Optional[List[CustomTag]] = None
168
+ """The recorded custom tags associated with the instance."""
169
+
128
170
  effective_enable_pg_native_login: Optional[bool] = None
129
- """xref AIP-129. `enable_pg_native_login` is owned by the client, while
130
- `effective_enable_pg_native_login` is owned by the server. `enable_pg_native_login` will only be
131
- set in Create/Update response messages if and only if the user provides the field via the
132
- request. `effective_enable_pg_native_login` on the other hand will always bet set in all
133
- response messages (Create/Update/Get/List)."""
171
+ """Whether the instance has PG native password login enabled."""
134
172
 
135
173
  effective_enable_readable_secondaries: Optional[bool] = None
136
- """xref AIP-129. `enable_readable_secondaries` is owned by the client, while
137
- `effective_enable_readable_secondaries` is owned by the server. `enable_readable_secondaries`
138
- will only be set in Create/Update response messages if and only if the user provides the field
139
- via the request. `effective_enable_readable_secondaries` on the other hand will always bet set
140
- in all response messages (Create/Update/Get/List)."""
174
+ """Whether secondaries serving read-only traffic are enabled. Defaults to false."""
141
175
 
142
176
  effective_node_count: Optional[int] = None
143
- """xref AIP-129. `node_count` is owned by the client, while `effective_node_count` is owned by the
144
- server. `node_count` will only be set in Create/Update response messages if and only if the user
145
- provides the field via the request. `effective_node_count` on the other hand will always bet set
146
- in all response messages (Create/Update/Get/List)."""
177
+ """The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults
178
+ to 1 primary and 0 secondaries."""
147
179
 
148
180
  effective_retention_window_in_days: Optional[int] = None
149
- """xref AIP-129. `retention_window_in_days` is owned by the client, while
150
- `effective_retention_window_in_days` is owned by the server. `retention_window_in_days` will
151
- only be set in Create/Update response messages if and only if the user provides the field via
152
- the request. `effective_retention_window_in_days` on the other hand will always bet set in all
153
- response messages (Create/Update/Get/List)."""
181
+ """The retention window for the instance. This is the time window in days for which the historical
182
+ data is retained."""
154
183
 
155
184
  effective_stopped: Optional[bool] = None
156
- """xref AIP-129. `stopped` is owned by the client, while `effective_stopped` is owned by the
157
- server. `stopped` will only be set in Create/Update response messages if and only if the user
158
- provides the field via the request. `effective_stopped` on the other hand will always bet set in
159
- all response messages (Create/Update/Get/List)."""
185
+ """Whether the instance is stopped."""
186
+
187
+ effective_usage_policy_id: Optional[str] = None
188
+ """The policy that is applied to the instance."""
160
189
 
161
190
  enable_pg_native_login: Optional[bool] = None
162
- """Whether the instance has PG native password login enabled. Defaults to true."""
191
+ """Whether to enable PG native password login on the instance. Defaults to false."""
163
192
 
164
193
  enable_readable_secondaries: Optional[bool] = None
165
194
  """Whether to enable secondaries to serve read-only traffic. Defaults to false."""
166
195
 
167
196
  node_count: Optional[int] = None
168
197
  """The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults
169
- to 1 primary and 0 secondaries."""
198
+ to 1 primary and 0 secondaries. This field is input only, see effective_node_count for the
199
+ output."""
170
200
 
171
201
  parent_instance_ref: Optional[DatabaseInstanceRef] = None
172
202
  """The ref of the parent instance. This is only available if the instance is child instance. Input:
@@ -191,11 +221,14 @@ class DatabaseInstance:
191
221
  """The current state of the instance."""
192
222
 
193
223
  stopped: Optional[bool] = None
194
- """Whether the instance is stopped."""
224
+ """Whether to stop the instance. An input only param, see effective_stopped for the output."""
195
225
 
196
226
  uid: Optional[str] = None
197
227
  """An immutable UUID identifier for the instance."""
198
228
 
229
+ usage_policy_id: Optional[str] = None
230
+ """The desired usage policy to associate with the instance."""
231
+
199
232
  def as_dict(self) -> dict:
200
233
  """Serializes the DatabaseInstance into a dictionary suitable for use as a JSON request body."""
201
234
  body = {}
@@ -207,6 +240,12 @@ class DatabaseInstance:
207
240
  body["creation_time"] = self.creation_time
208
241
  if self.creator is not None:
209
242
  body["creator"] = self.creator
243
+ if self.custom_tags:
244
+ body["custom_tags"] = [v.as_dict() for v in self.custom_tags]
245
+ if self.effective_capacity is not None:
246
+ body["effective_capacity"] = self.effective_capacity
247
+ if self.effective_custom_tags:
248
+ body["effective_custom_tags"] = [v.as_dict() for v in self.effective_custom_tags]
210
249
  if self.effective_enable_pg_native_login is not None:
211
250
  body["effective_enable_pg_native_login"] = self.effective_enable_pg_native_login
212
251
  if self.effective_enable_readable_secondaries is not None:
@@ -217,6 +256,8 @@ class DatabaseInstance:
217
256
  body["effective_retention_window_in_days"] = self.effective_retention_window_in_days
218
257
  if self.effective_stopped is not None:
219
258
  body["effective_stopped"] = self.effective_stopped
259
+ if self.effective_usage_policy_id is not None:
260
+ body["effective_usage_policy_id"] = self.effective_usage_policy_id
220
261
  if self.enable_pg_native_login is not None:
221
262
  body["enable_pg_native_login"] = self.enable_pg_native_login
222
263
  if self.enable_readable_secondaries is not None:
@@ -241,6 +282,8 @@ class DatabaseInstance:
241
282
  body["stopped"] = self.stopped
242
283
  if self.uid is not None:
243
284
  body["uid"] = self.uid
285
+ if self.usage_policy_id is not None:
286
+ body["usage_policy_id"] = self.usage_policy_id
244
287
  return body
245
288
 
246
289
  def as_shallow_dict(self) -> dict:
@@ -254,6 +297,12 @@ class DatabaseInstance:
254
297
  body["creation_time"] = self.creation_time
255
298
  if self.creator is not None:
256
299
  body["creator"] = self.creator
300
+ if self.custom_tags:
301
+ body["custom_tags"] = self.custom_tags
302
+ if self.effective_capacity is not None:
303
+ body["effective_capacity"] = self.effective_capacity
304
+ if self.effective_custom_tags:
305
+ body["effective_custom_tags"] = self.effective_custom_tags
257
306
  if self.effective_enable_pg_native_login is not None:
258
307
  body["effective_enable_pg_native_login"] = self.effective_enable_pg_native_login
259
308
  if self.effective_enable_readable_secondaries is not None:
@@ -264,6 +313,8 @@ class DatabaseInstance:
264
313
  body["effective_retention_window_in_days"] = self.effective_retention_window_in_days
265
314
  if self.effective_stopped is not None:
266
315
  body["effective_stopped"] = self.effective_stopped
316
+ if self.effective_usage_policy_id is not None:
317
+ body["effective_usage_policy_id"] = self.effective_usage_policy_id
267
318
  if self.enable_pg_native_login is not None:
268
319
  body["enable_pg_native_login"] = self.enable_pg_native_login
269
320
  if self.enable_readable_secondaries is not None:
@@ -288,6 +339,8 @@ class DatabaseInstance:
288
339
  body["stopped"] = self.stopped
289
340
  if self.uid is not None:
290
341
  body["uid"] = self.uid
342
+ if self.usage_policy_id is not None:
343
+ body["usage_policy_id"] = self.usage_policy_id
291
344
  return body
292
345
 
293
346
  @classmethod
@@ -298,11 +351,15 @@ class DatabaseInstance:
298
351
  child_instance_refs=_repeated_dict(d, "child_instance_refs", DatabaseInstanceRef),
299
352
  creation_time=d.get("creation_time", None),
300
353
  creator=d.get("creator", None),
354
+ custom_tags=_repeated_dict(d, "custom_tags", CustomTag),
355
+ effective_capacity=d.get("effective_capacity", None),
356
+ effective_custom_tags=_repeated_dict(d, "effective_custom_tags", CustomTag),
301
357
  effective_enable_pg_native_login=d.get("effective_enable_pg_native_login", None),
302
358
  effective_enable_readable_secondaries=d.get("effective_enable_readable_secondaries", None),
303
359
  effective_node_count=d.get("effective_node_count", None),
304
360
  effective_retention_window_in_days=d.get("effective_retention_window_in_days", None),
305
361
  effective_stopped=d.get("effective_stopped", None),
362
+ effective_usage_policy_id=d.get("effective_usage_policy_id", None),
306
363
  enable_pg_native_login=d.get("enable_pg_native_login", None),
307
364
  enable_readable_secondaries=d.get("enable_readable_secondaries", None),
308
365
  name=d.get("name", None),
@@ -315,6 +372,7 @@ class DatabaseInstance:
315
372
  state=_enum(d, "state", DatabaseInstanceState),
316
373
  stopped=d.get("stopped", None),
317
374
  uid=d.get("uid", None),
375
+ usage_policy_id=d.get("usage_policy_id", None),
318
376
  )
319
377
 
320
378
 
@@ -335,12 +393,9 @@ class DatabaseInstanceRef:
335
393
  provided as input to create a child instance."""
336
394
 
337
395
  effective_lsn: Optional[str] = None
338
- """xref AIP-129. `lsn` is owned by the client, while `effective_lsn` is owned by the server. `lsn`
339
- will only be set in Create/Update response messages if and only if the user provides the field
340
- via the request. `effective_lsn` on the other hand will always bet set in all response messages
341
- (Create/Update/Get/List). For a parent ref instance, this is the LSN on the parent instance from
342
- which the instance was created. For a child ref instance, this is the LSN on the instance from
343
- which the child instance was created."""
396
+ """For a parent ref instance, this is the LSN on the parent instance from which the instance was
397
+ created. For a child ref instance, this is the LSN on the instance from which the child instance
398
+ was created."""
344
399
 
345
400
  lsn: Optional[str] = None
346
401
  """User-specified WAL LSN of the ref database instance.
@@ -400,25 +455,34 @@ class DatabaseInstanceRef:
400
455
  class DatabaseInstanceRole:
401
456
  """A DatabaseInstanceRole represents a Postgres role in a database instance."""
402
457
 
458
+ name: str
459
+ """The name of the role. This is the unique identifier for the role in an instance."""
460
+
403
461
  attributes: Optional[DatabaseInstanceRoleAttributes] = None
404
- """API-exposed Postgres role attributes"""
462
+ """The desired API-exposed Postgres role attribute to associate with the role. Optional."""
463
+
464
+ effective_attributes: Optional[DatabaseInstanceRoleAttributes] = None
465
+ """The attributes that are applied to the role."""
405
466
 
406
467
  identity_type: Optional[DatabaseInstanceRoleIdentityType] = None
407
468
  """The type of the role."""
408
469
 
470
+ instance_name: Optional[str] = None
471
+
409
472
  membership_role: Optional[DatabaseInstanceRoleMembershipRole] = None
410
473
  """An enum value for a standard role that this role is a member of."""
411
474
 
412
- name: Optional[str] = None
413
- """The name of the role. This is the unique identifier for the role in an instance."""
414
-
415
475
  def as_dict(self) -> dict:
416
476
  """Serializes the DatabaseInstanceRole into a dictionary suitable for use as a JSON request body."""
417
477
  body = {}
418
478
  if self.attributes:
419
479
  body["attributes"] = self.attributes.as_dict()
480
+ if self.effective_attributes:
481
+ body["effective_attributes"] = self.effective_attributes.as_dict()
420
482
  if self.identity_type is not None:
421
483
  body["identity_type"] = self.identity_type.value
484
+ if self.instance_name is not None:
485
+ body["instance_name"] = self.instance_name
422
486
  if self.membership_role is not None:
423
487
  body["membership_role"] = self.membership_role.value
424
488
  if self.name is not None:
@@ -430,8 +494,12 @@ class DatabaseInstanceRole:
430
494
  body = {}
431
495
  if self.attributes:
432
496
  body["attributes"] = self.attributes
497
+ if self.effective_attributes:
498
+ body["effective_attributes"] = self.effective_attributes
433
499
  if self.identity_type is not None:
434
500
  body["identity_type"] = self.identity_type
501
+ if self.instance_name is not None:
502
+ body["instance_name"] = self.instance_name
435
503
  if self.membership_role is not None:
436
504
  body["membership_role"] = self.membership_role
437
505
  if self.name is not None:
@@ -443,7 +511,9 @@ class DatabaseInstanceRole:
443
511
  """Deserializes the DatabaseInstanceRole from a dictionary."""
444
512
  return cls(
445
513
  attributes=_from_dict(d, "attributes", DatabaseInstanceRoleAttributes),
514
+ effective_attributes=_from_dict(d, "effective_attributes", DatabaseInstanceRoleAttributes),
446
515
  identity_type=_enum(d, "identity_type", DatabaseInstanceRoleIdentityType),
516
+ instance_name=d.get("instance_name", None),
447
517
  membership_role=_enum(d, "membership_role", DatabaseInstanceRoleMembershipRole),
448
518
  name=d.get("name", None),
449
519
  )
@@ -1537,22 +1607,32 @@ class DatabaseAPI:
1537
1607
  return self.create_database_instance(database_instance=database_instance).result(timeout=timeout)
1538
1608
 
1539
1609
  def create_database_instance_role(
1540
- self, instance_name: str, database_instance_role: DatabaseInstanceRole
1610
+ self,
1611
+ instance_name: str,
1612
+ database_instance_role: DatabaseInstanceRole,
1613
+ *,
1614
+ database_instance_name: Optional[str] = None,
1541
1615
  ) -> DatabaseInstanceRole:
1542
1616
  """Create a role for a Database Instance.
1543
1617
 
1544
1618
  :param instance_name: str
1545
1619
  :param database_instance_role: :class:`DatabaseInstanceRole`
1620
+ :param database_instance_name: str (optional)
1546
1621
 
1547
1622
  :returns: :class:`DatabaseInstanceRole`
1548
1623
  """
1549
1624
  body = database_instance_role.as_dict()
1625
+ query = {}
1626
+ if database_instance_name is not None:
1627
+ query["database_instance_name"] = database_instance_name
1550
1628
  headers = {
1551
1629
  "Accept": "application/json",
1552
1630
  "Content-Type": "application/json",
1553
1631
  }
1554
1632
 
1555
- res = self._api.do("POST", f"/api/2.0/database/instances/{instance_name}/roles", body=body, headers=headers)
1633
+ res = self._api.do(
1634
+ "POST", f"/api/2.0/database/instances/{instance_name}/roles", query=query, body=body, headers=headers
1635
+ )
1556
1636
  return DatabaseInstanceRole.from_dict(res)
1557
1637
 
1558
1638
  def create_database_table(self, table: DatabaseTable) -> DatabaseTable:
@@ -1611,12 +1691,8 @@ class DatabaseAPI:
1611
1691
  By default, a instance cannot be deleted if it has descendant instances created via PITR. If this
1612
1692
  flag is specified as true, all descendent instances will be deleted as well.
1613
1693
  :param purge: bool (optional)
1614
- Note purge=false is in development. If false, the database instance is soft deleted (implementation
1615
- pending). Soft deleted instances behave as if they are deleted, and cannot be used for CRUD
1616
- operations nor connected to. However they can be undeleted by calling the undelete API for a limited
1617
- time (implementation pending). If true, the database instance is hard deleted and cannot be
1618
- undeleted. For the time being, setting this value to true is required to delete an instance (soft
1619
- delete is not yet supported).
1694
+ Deprecated. Omitting the field or setting it to true will result in the field being hard deleted.
1695
+ Setting a value of false will throw a bad request.
1620
1696
 
1621
1697
 
1622
1698
  """