-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to create EventHub namespace with kafka #711
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,12 @@ public class EHNamespaceInner extends Resource { | |
@JsonProperty(value = "sku") | ||
private Sku sku; | ||
|
||
/** | ||
* Properties of kafka resource. | ||
*/ | ||
@JsonProperty(value = "kafkaEnabled") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thamer-ea |
||
private boolean kafkaEnabled; | ||
|
||
/** | ||
* Provisioning state of the Namespace. | ||
*/ | ||
|
@@ -175,4 +181,23 @@ public EHNamespaceInner withMaximumThroughputUnits(Integer maximumThroughputUnit | |
return this; | ||
} | ||
|
||
/** | ||
* Get the kafkaEnabled value. | ||
* | ||
* @return the kafkaEnabled value | ||
*/ | ||
public boolean kafkaEnabled() { | ||
return this.kafkaEnabled; | ||
} | ||
|
||
/** | ||
* Set the kafkaEnabled value. | ||
* | ||
* @param kafkaEnabled the kafkaEnabled value to set | ||
* @return the EHNamespaceInner object itself. | ||
*/ | ||
public EHNamespaceInner withKafkaEnabled(boolean kafkaEnabled) { | ||
this.kafkaEnabled = kafkaEnabled; | ||
return this; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,18 +166,45 @@ public void canManageEventHubNamespaceEventHubs() throws Exception { | |
} | ||
|
||
@Test | ||
public void canManageEventHubNamespaceAuthorizationRules() throws Exception { | ||
public void canManageEventHubNamespaceWithKafka() throws Exception { | ||
RG_NAME = generateRandomResourceName("javacsmrg", 15); | ||
final String namespaceName = SdkContext.randomResourceName("ns", 14); | ||
|
||
EventHubNamespace namespace = eventHubManager.namespaces() | ||
.define(namespaceName) | ||
.withRegion(REGION) | ||
.withNewResourceGroup(RG_NAME) | ||
.withNewManageRule("mngRule1") | ||
.withNewSendRule("sndRule1") | ||
.withKafka() | ||
.create(); | ||
|
||
Assert.assertNotNull(namespace); | ||
Assert.assertNotNull(namespace.inner()); | ||
Assert.assertTrue(namespace.isKafkaEnabled()); | ||
|
||
EventHubNamespace namespace2 = eventHubManager.namespaces() | ||
.define(namespaceName) | ||
.withRegion(REGION) | ||
.withNewResourceGroup(RG_NAME) | ||
.create(); | ||
|
||
Assert.assertNotNull(namespace); | ||
Assert.assertNotNull(namespace.inner()); | ||
Assert.assertFalse(namespace.isKafkaEnabled()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thamer-ea |
||
} | ||
|
||
@Test | ||
public void canManageEventHubNamespaceAuthorizationRules() throws Exception { | ||
RG_NAME = generateRandomResourceName("javacsmrg", 15); | ||
final String namespaceName = SdkContext.randomResourceName("ns", 14); | ||
|
||
EventHubNamespace namespace = eventHubManager.namespaces() | ||
.define(namespaceName) | ||
.withRegion(REGION) | ||
.withNewResourceGroup(RG_NAME) | ||
.withNewManageRule("mngRule1") | ||
.withNewSendRule("sndRule1") | ||
.create(); | ||
|
||
Assert.assertNotNull(namespace); | ||
Assert.assertNotNull(namespace.inner()); | ||
|
||
|
@@ -202,10 +229,10 @@ public void canManageEventHubNamespaceAuthorizationRules() throws Exception { | |
|
||
eventHubManager.namespaces() | ||
.authorizationRules() | ||
.define("sndRule2") | ||
.withExistingNamespaceId(namespace.id()) | ||
.withSendAccess() | ||
.create(); | ||
.define("sndRule2") | ||
.withExistingNamespaceId(namespace.id()) | ||
.withSendAccess() | ||
.create(); | ||
|
||
rules = namespace.listAuthorizationRules(); | ||
set.clear(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be 1.22 ?