You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Jim Spring <no...@github.com> on 2016/06/02 04:24:42 UTC

[jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

@nacx This pull request implements the REST API calls for Azure Resource Manager Network Security Group and Network Security Rule APIs (they do intersect).  This PR has no dependencies on any PRs outside what is currently in master for jclouds-labs.
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/278

-- Commit Summary --

  * Network Security Group API and Network Security Group Rule API

-- File Changes --

    M azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java (18)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkSecurityGroup.java (54)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkSecurityGroupProperties.java (61)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkSecurityRule.java (46)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/NetworkSecurityRuleProperties.java (108)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java (84)
    A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityRuleApi.java (93)
    A azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiLiveTest.java (121)
    A azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApiMockTest.java (158)
    A azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityRuleApiLiveTest.java (192)
    A azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/NetworkSecurityRuleApiMockTest.java (199)
    A azurecompute-arm/src/test/resources/networksecuritygroupcreate.json (125)
    A azurecompute-arm/src/test/resources/networksecuritygroupget.json (125)
    A azurecompute-arm/src/test/resources/networksecuritygrouplist.json (127)
    A azurecompute-arm/src/test/resources/networksecurityrulecreate.json (17)
    A azurecompute-arm/src/test/resources/networksecurityruleget.json (17)
    A azurecompute-arm/src/test/resources/networksecurityrulegetdefault.json (17)
    A azurecompute-arm/src/test/resources/networksecurityrulelist.json (35)
    A azurecompute-arm/src/test/resources/networksecurityrulelistdefault.json (99)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/278.patch
https://github.com/jclouds/jclouds-labs/pull/278.diff

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Jim Spring <no...@github.com>.
URI used for delete, tests updated.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278#issuecomment-223340548

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Rita Zhang <no...@github.com>.
> +@QueryParams(keys = "api-version", values = "2016-03-30")
> +@RequestFilters(OAuthFilter.class)
> +@Consumes(MediaType.APPLICATION_JSON)
> +public interface NetworkSecurityGroupApi {
> +
> +   @Named("networksecuritygroup:list")
> +   @GET
> +   @SelectJson("value")
> +   @Fallback(EmptyListOnNotFoundOr404.class)
> +   List<NetworkSecurityGroup> list();
> +
> +   @Named("networksecuritygroup:delete")
> +   @Path("/{networksecuritygroupname}")
> +   @DELETE
> +   @ResponseParser(FalseOn204.class)
> +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);

Since this delete is async, consider using `URIParser`, similar to [this](https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/ResourceGroupApi.java#L89-L94)

Please also test the returned uri to ensure it is not null. Also add the fallback test case like [this](https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java#L141-L148)

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65485172

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Rita Zhang <no...@github.com>.
> +   @GET
> +   @SelectJson("value")
> +   @Fallback(EmptyListOnNotFoundOr404.class)
> +   List<NetworkSecurityGroup> list();
> +
> +   @Named("networksecuritygroup:delete")
> +   @Path("/{networksecuritygroupname}")
> +   @DELETE
> +   @ResponseParser(FalseOn204.class)
> +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);
> +
> +   @Named("networksecuritygroup:create_or_update")
> +   @Path("/{networksecuritygroupname}")
> +   @PUT
> +   @MapBinder(BindToJsonPayload.class)
> +   @Fallback(NullOnNotFoundOr404.class)

Don't use 404 fallbacks in POST/PUT

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65485262

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Jim Spring <no...@github.com>.
Redoing due to PR / tree getting into a bad state.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278#issuecomment-223989638

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Rita Zhang <no...@github.com>.
> +   @Path("/defaultSecurityRules/{networksecurityrulename}")
> +   @GET
> +   @Fallback(NullOnNotFoundOr404.class)
> +   NetworkSecurityRule get_default_rule(@PathParam("networksecurityrulename") String ruleName);
> +
> +   @Named("networksecurityrule:get")
> +   @Path("/securityRules/{networksecurityrulename}")
> +   @GET
> +   @Fallback(NullOnNotFoundOr404.class)
> +   NetworkSecurityRule get(@PathParam("networksecurityrulename") String ruleName);
> +
> +   @Named("networksecurityrule:delete")
> +   @Path("/securityRules/{networksecurityrulename}")
> +   @DELETE
> +   @ResponseParser(FalseOn204.class)
> +   boolean delete(@PathParam("networksecurityrulename") String ruleName);

Since this delete is async, consider using `URIParser`, similar to [this](https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/ResourceGroupApi.java#L89-L94)

Please also test the returned uri to ensure it is not null. Also add the fallback test case like [this](https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/ResourceGroupApiMockTest.java#L141-L148)

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65484967

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Rita Zhang <no...@github.com>.
> +import javax.ws.rs.PUT;
> +import javax.ws.rs.PathParam;
> +import javax.ws.rs.core.MediaType;
> +import java.util.List;
> +
> +@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/networkSecurityGroups/{networksecuritygroup}")
> +
> +@QueryParams(keys = "api-version", values = "2016-03-30")
> +@RequestFilters(OAuthFilter.class)
> +@Consumes(MediaType.APPLICATION_JSON)
> +public interface NetworkSecurityRuleApi {
> +   @Named("networksecurityrule:create_or_update")
> +   @Path("/securityRules/{networksecurityrulename}")
> +   @PUT
> +   @MapBinder(BindToJsonPayload.class)
> +   @Fallback(NullOnNotFoundOr404.class)

Don't use 404 fallbacks in POST/PUT

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65485303

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Jim Spring <no...@github.com>.
> +@QueryParams(keys = "api-version", values = "2016-03-30")
> +@RequestFilters(OAuthFilter.class)
> +@Consumes(MediaType.APPLICATION_JSON)
> +public interface NetworkSecurityGroupApi {
> +
> +   @Named("networksecuritygroup:list")
> +   @GET
> +   @SelectJson("value")
> +   @Fallback(EmptyListOnNotFoundOr404.class)
> +   List<NetworkSecurityGroup> list();
> +
> +   @Named("networksecuritygroup:delete")
> +   @Path("/{networksecuritygroupname}")
> +   @DELETE
> +   @ResponseParser(FalseOn204.class)
> +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);

I'll take a look

Sent from my iThingy

> On Jun 1, 2016, at 22:14, Rita Zhang <no...@github.com> wrote:
> 
> In azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java:
> 
> > +@QueryParams(keys = "api-version", values = "2016-03-30")
> > +@RequestFilters(OAuthFilter.class)
> > +@Consumes(MediaType.APPLICATION_JSON)
> > +public interface NetworkSecurityGroupApi {
> > +
> > +   @Named("networksecuritygroup:list")
> > +   @GET
> > +   @SelectJson("value")
> > +   @Fallback(EmptyListOnNotFoundOr404.class)
> > +   List<NetworkSecurityGroup> list();
> > +
> > +   @Named("networksecuritygroup:delete")
> > +   @Path("/{networksecuritygroupname}")
> > +   @DELETE
> > +   @ResponseParser(FalseOn204.class)
> > +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);
> Since this delete is async, consider using URIParser, similar to this
> 
> Please also test the returned uri to ensure it is not null. Also add the fallback test case like this
> 
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
> 


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65486636

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Jim Spring <no...@github.com>.
Closed #278.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278#event-682996931

Re: [jclouds/jclouds-labs] Network Security Group API and Network Security Group Rule API (#278)

Posted by Jim Spring <no...@github.com>.
> +   @GET
> +   @SelectJson("value")
> +   @Fallback(EmptyListOnNotFoundOr404.class)
> +   List<NetworkSecurityGroup> list();
> +
> +   @Named("networksecuritygroup:delete")
> +   @Path("/{networksecuritygroupname}")
> +   @DELETE
> +   @ResponseParser(FalseOn204.class)
> +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);
> +
> +   @Named("networksecuritygroup:create_or_update")
> +   @Path("/{networksecuritygroupname}")
> +   @PUT
> +   @MapBinder(BindToJsonPayload.class)
> +   @Fallback(NullOnNotFoundOr404.class)

Specific example for the 404s?  Thanks.

Sent from my iThingy

> On Jun 1, 2016, at 22:16, Rita Zhang <no...@github.com> wrote:
> 
> In azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/NetworkSecurityGroupApi.java:
> 
> > +   @GET
> > +   @SelectJson("value")
> > +   @Fallback(EmptyListOnNotFoundOr404.class)
> > +   List<NetworkSecurityGroup> list();
> > +
> > +   @Named("networksecuritygroup:delete")
> > +   @Path("/{networksecuritygroupname}")
> > +   @DELETE
> > +   @ResponseParser(FalseOn204.class)
> > +   boolean delete(@PathParam("networksecuritygroupname") String nsgName);
> > +
> > +   @Named("networksecuritygroup:create_or_update")
> > +   @Path("/{networksecuritygroupname}")
> > +   @PUT
> > +   @MapBinder(BindToJsonPayload.class)
> > +   @Fallback(NullOnNotFoundOr404.class)
> Don't use 404 fallbacks in POST/PUT
> 
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
> 


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/278/files/76791340f71414d5966d0239904de9b7ab673919#r65486501