Skip to content
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

Can't reorder gateway firewall rule using apiClient (nsx-t) #4

Open
jayyyyyyy opened this issue Oct 17, 2019 · 1 comment
Open

Can't reorder gateway firewall rule using apiClient (nsx-t) #4

jayyyyyyy opened this issue Oct 17, 2019 · 1 comment

Comments

@jayyyyyyy
Copy link

Hi! I am developing automation tool which create gateway firewall rule.

I don't know if I can post a question here but I have no place to post.

I developed using java sdk (2.4.1) But I could not use revise method.

I filled out parameter but it doesn't work.

my code is below.

ApiClient apiClient = getApiClient(firewallInfo);
Rules ruleService = apiClient.createStub(Rules.class);
String ruleId = fwRuleInfo.getAssignedRuleId();
String location = fwRuleInfo.getOrderLocation();
Rule rule = ruleService.get(DEFAULT_DOMAIN_ID, DEFAULT_POLICY_ID, ruleId);
// bottom
ruleService.revise(DEFAULT_DOMAIN_ID, DEFAULT_POLICY_ID, ruleId, rule, null, RulesTypes.REVISE_OPERATION_BOTTOM);

// after
ruleService.revise(DEFAULT_DOMAIN_ID, DEFAULT_POLICY_ID, ruleId, rule, location, RulesTypes.REVISE_OPERATION_AFTER);

// before
ruleService.revise(DEFAULT_DOMAIN_ID, DEFAULT_POLICY_ID, ruleId, rule, location, RulesTypes.REVISE_OPERATION_BEFORE);

ErrorMessage is below.
com.vmware.vapi.std.errors.InvalidRequest: InvalidRequest (com.vmware.vapi.std.errors.invalid_request) => {
messages = [],
data = struct => {error_message=Method is not allowed, error_code=282, module_name=common-services},
errorType = INVALID_REQUEST
}
at com.vmware.vapi.std.errors.InvalidRequest._newInstance2(InvalidRequest.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vmware.vapi.internal.bindings.convert.impl.JavaClassStructConverter.createStructBinding(JavaClassStructConverter.java:220)
at com.vmware.vapi.internal.bindings.convert.impl.JavaClassStructConverter.fromValue(JavaClassStructConverter.java:78)
at com.vmware.vapi.internal.bindings.convert.impl.JavaClassStructConverter.fromValue(JavaClassStructConverter.java:32)
at com.vmware.vapi.internal.bindings.TypeConverterImpl$ValueToJavaVisitor.visit(TypeConverterImpl.java:346)
at com.vmware.vapi.bindings.type.ErrorType.accept(ErrorType.java:31)
at com.vmware.vapi.internal.bindings.TypeConverterImpl.convertToJava(TypeConverterImpl.java:688)
at com.vmware.vapi.internal.bindings.Stub.convert(Stub.java:417)
at com.vmware.vapi.internal.bindings.Stub.convertError(Stub.java:434)
at com.vmware.vapi.internal.bindings.Stub.access$300(Stub.java:57)
at com.vmware.vapi.internal.bindings.Stub$2.setResult(Stub.java:239)
at com.vmware.vapi.internal.bindings.Stub$2.setResult(Stub.java:230)
at com.vmware.vapi.internal.protocol.client.rest.DefaultRequestExecutorFactory$DefaultHttpResponseHandler.onResult(DefaultRequestExecutorFactory.java:86)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor$AuthzRefreshingHttpResponseHandler.onResult(AuthzRefreshingRequestExecutorFactory.java:160)
at com.vmware.vapi.internal.protocol.client.rpc.http.ApacheClientRestTransport.execute(ApacheClientRestTransport.java:79)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor.authorizeAndExecute(AuthzRefreshingRequestExecutorFactory.java:112)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor.access$100(AuthzRefreshingRequestExecutorFactory.java:58)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor$1.onComplete(AuthzRefreshingRequestExecutorFactory.java:98)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor.refreshContext(AuthzRefreshingRequestExecutorFactory.java:188)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor.refreshContextIfNeeded(AuthzRefreshingRequestExecutorFactory.java:171)
at com.vmware.vapi.vmc.client.authz.AuthzRefreshingRequestExecutorFactory$AuthzRefreshingRequestExecutor.execute(AuthzRefreshingRequestExecutorFactory.java:105)
at com.vmware.vapi.internal.protocol.client.rest.RestClientApiProvider.invoke(RestClientApiProvider.java:70)
at com.vmware.vapi.internal.bindings.Stub.invoke(Stub.java:225)
at com.vmware.vapi.internal.bindings.Stub.invoke(Stub.java:206)
at com.vmware.vapi.internal.bindings.Stub.invokeMethodAsync(Stub.java:170)
at com.vmware.vapi.internal.bindings.Stub.invokeMethod(Stub.java:138)
at com.vmware.nsx_policy.infra.domains.gateway_policies.RulesStub.revise(RulesStub.java:226)
at com.vmware.nsx_policy.infra.domains.gateway_policies.RulesStub.revise(RulesStub.java:213)

is this bug or am i use wrong ?

thank you.

@ggoodvmw
Copy link
Collaborator

Can you please post a complete example? I can't tell what the types are of many of your objects since you didn't include the Java import statements and field definitions. If you post it on https://gist.github.com/ that would really help.

ggoodvmw pushed a commit that referenced this issue May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants