Skip to content

Commit feb3366

Browse files
authored
chore: updates to managedkafka (googleapis#14074)
This splits the changes that were joined together in googleapis#14063 so that releases can have proper release notes. BEGIN_COMMIT_OVERRIDE feat: update libraries and clients for Managed Kafka END_COMMIT_OVERRIDE PiperOrigin-RevId: 780098649
1 parent 47fa122 commit feb3366

10 files changed

Lines changed: 193 additions & 44 deletions

File tree

packages/google-cloud-managedkafka/google/cloud/managedkafka/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
OperationMetadata,
101101
RebalanceConfig,
102102
TaskRetryPolicy,
103+
TlsConfig,
103104
Topic,
105+
TrustConfig,
104106
)
105107

106108
__all__ = (
@@ -173,5 +175,7 @@
173175
"OperationMetadata",
174176
"RebalanceConfig",
175177
"TaskRetryPolicy",
178+
"TlsConfig",
176179
"Topic",
180+
"TrustConfig",
177181
)

packages/google-cloud-managedkafka/google/cloud/managedkafka/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.11" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@
9393
OperationMetadata,
9494
RebalanceConfig,
9595
TaskRetryPolicy,
96+
TlsConfig,
9697
Topic,
98+
TrustConfig,
9799
)
98100

99101
__all__ = (
@@ -160,7 +162,9 @@
160162
"StopConnectorRequest",
161163
"StopConnectorResponse",
162164
"TaskRetryPolicy",
165+
"TlsConfig",
163166
"Topic",
167+
"TrustConfig",
164168
"UpdateAclRequest",
165169
"UpdateClusterRequest",
166170
"UpdateConnectClusterRequest",

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.11" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/services/managed_kafka/async_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class ManagedKafkaAsyncClient:
8585

8686
acl_path = staticmethod(ManagedKafkaClient.acl_path)
8787
parse_acl_path = staticmethod(ManagedKafkaClient.parse_acl_path)
88+
ca_pool_path = staticmethod(ManagedKafkaClient.ca_pool_path)
89+
parse_ca_pool_path = staticmethod(ManagedKafkaClient.parse_ca_pool_path)
8890
cluster_path = staticmethod(ManagedKafkaClient.cluster_path)
8991
parse_cluster_path = staticmethod(ManagedKafkaClient.parse_cluster_path)
9092
consumer_group_path = staticmethod(ManagedKafkaClient.consumer_group_path)

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/services/managed_kafka/client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,28 @@ def parse_acl_path(path: str) -> Dict[str, str]:
228228
)
229229
return m.groupdict() if m else {}
230230

231+
@staticmethod
232+
def ca_pool_path(
233+
project: str,
234+
location: str,
235+
ca_pool: str,
236+
) -> str:
237+
"""Returns a fully-qualified ca_pool string."""
238+
return "projects/{project}/locations/{location}/caPools/{ca_pool}".format(
239+
project=project,
240+
location=location,
241+
ca_pool=ca_pool,
242+
)
243+
244+
@staticmethod
245+
def parse_ca_pool_path(path: str) -> Dict[str, str]:
246+
"""Parses a ca_pool path into its component segments."""
247+
m = re.match(
248+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/caPools/(?P<ca_pool>.+?)$",
249+
path,
250+
)
251+
return m.groupdict() if m else {}
252+
231253
@staticmethod
232254
def cluster_path(
233255
project: str,

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@
8383
OperationMetadata,
8484
RebalanceConfig,
8585
TaskRetryPolicy,
86+
TlsConfig,
8687
Topic,
88+
TrustConfig,
8789
)
8890

8991
__all__ = (
@@ -152,5 +154,7 @@
152154
"OperationMetadata",
153155
"RebalanceConfig",
154156
"TaskRetryPolicy",
157+
"TlsConfig",
155158
"Topic",
159+
"TrustConfig",
156160
)

packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/types/resources.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"NetworkConfig",
3131
"AccessConfig",
3232
"GcpConfig",
33+
"TlsConfig",
34+
"TrustConfig",
3335
"Topic",
3436
"ConsumerTopicMetadata",
3537
"ConsumerPartitionMetadata",
@@ -86,6 +88,9 @@ class Cluster(proto.Message):
8688
Output only. Reserved for future use.
8789
8890
This field is a member of `oneof`_ ``_satisfies_pzs``.
91+
tls_config (google.cloud.managedkafka_v1.types.TlsConfig):
92+
Optional. TLS configuration for the Kafka
93+
cluster.
8994
"""
9095

9196
class State(proto.Enum):
@@ -156,6 +161,11 @@ class State(proto.Enum):
156161
number=12,
157162
optional=True,
158163
)
164+
tls_config: "TlsConfig" = proto.Field(
165+
proto.MESSAGE,
166+
number=13,
167+
message="TlsConfig",
168+
)
159169

160170

161171
class CapacityConfig(proto.Message):
@@ -280,6 +290,75 @@ class GcpConfig(proto.Message):
280290
)
281291

282292

293+
class TlsConfig(proto.Message):
294+
r"""The TLS configuration for the Kafka cluster.
295+
296+
Attributes:
297+
trust_config (google.cloud.managedkafka_v1.types.TrustConfig):
298+
Optional. The configuration of the broker
299+
truststore. If specified, clients can use mTLS
300+
for authentication.
301+
ssl_principal_mapping_rules (str):
302+
Optional. A list of rules for mapping from SSL principal
303+
names to short names. These are applied in order by Kafka.
304+
Refer to the Apache Kafka documentation for
305+
``ssl.principal.mapping.rules`` for the precise formatting
306+
details and syntax. Example:
307+
"RULE:^CN=(.*?),OU=ServiceUsers.*\ $/$1@example.com/,DEFAULT"
308+
309+
This is a static Kafka broker configuration. Setting or
310+
modifying this field will trigger a rolling restart of the
311+
Kafka brokers to apply the change. An empty string means no
312+
rules are applied (Kafka default).
313+
"""
314+
315+
trust_config: "TrustConfig" = proto.Field(
316+
proto.MESSAGE,
317+
number=1,
318+
message="TrustConfig",
319+
)
320+
ssl_principal_mapping_rules: str = proto.Field(
321+
proto.STRING,
322+
number=2,
323+
)
324+
325+
326+
class TrustConfig(proto.Message):
327+
r"""Sources of CA certificates to install in the broker's
328+
truststore.
329+
330+
Attributes:
331+
cas_configs (MutableSequence[google.cloud.managedkafka_v1.types.TrustConfig.CertificateAuthorityServiceConfig]):
332+
Optional. Configuration for the Google
333+
Certificate Authority Service. Maximum 10.
334+
"""
335+
336+
class CertificateAuthorityServiceConfig(proto.Message):
337+
r"""A configuration for the Google Certificate Authority Service.
338+
339+
Attributes:
340+
ca_pool (str):
341+
Required. The name of the CA pool to pull CA certificates
342+
from. Structured like:
343+
projects/{project}/locations/{location}/caPools/{ca_pool}.
344+
The CA pool does not need to be in the same project or
345+
location as the Kafka cluster.
346+
"""
347+
348+
ca_pool: str = proto.Field(
349+
proto.STRING,
350+
number=1,
351+
)
352+
353+
cas_configs: MutableSequence[
354+
CertificateAuthorityServiceConfig
355+
] = proto.RepeatedField(
356+
proto.MESSAGE,
357+
number=1,
358+
message=CertificateAuthorityServiceConfig,
359+
)
360+
361+
283362
class Topic(proto.Message):
284363
r"""A Kafka topic in a given cluster.
285364

packages/google-cloud-managedkafka/samples/generated_samples/snippet_metadata_google.cloud.managedkafka.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-managedkafka",
11-
"version": "0.1.11"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)