Merge lp://staging/~allenap/gwacl/get-network-configuration into lp://staging/gwacl

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 179
Merged at revision: 170
Proposed branch: lp://staging/~allenap/gwacl/get-network-configuration
Merge into: lp://staging/gwacl
Diff against target: 457 lines (+263/-27)
8 files modified
example/management/run.go (+12/-2)
helpers_apiobjects_test.go (+1/-1)
httperror.go (+4/-4)
httperror_test.go (+6/-3)
management_base.go (+19/-0)
management_base_test.go (+94/-1)
xmlobjects.go (+11/-8)
xmlobjects_test.go (+116/-8)
To merge this branch: bzr merge lp://staging/~allenap/gwacl/get-network-configuration
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+173808@code.staging.launchpad.net

Commit message

New method GetNetworkConfiguration.

Description of the change

- Rename SetNetworkConfiguation to remove the Set prefix because it's
  generally applicable for Get too.

- Rename ConfigurationSet constructors to have Set suffix, to prevent
  naming conflict with renamed NetworkConfiguration stuff.

- Fix IsNotFoundError() to work with HTTPError, not just ServerError.
  I think it's meant to work with HTTPError in general, but the
  example data was inadvertently using only ServerError. The calls to
  newHTTPError were hiding this, so I've changed it to explicitly use
  AzureError and ServerError.

- If there's no virtual network configured, Azure returns an HTTP 404
  when getting the network configuration. When this happens,
  GetNetworkConfiguration returns nil.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

review: needs-information

Needs info because of [1]

[1]

> -type SetNetworkConfiguration struct { - XMLName
> xml.Name `xml:"NetworkConfiguration"` +type
> NetworkConfiguration struct { XMLNS string
> `xml:"xmlns,attr"` - XMLNS_XSI string
> `xml:"xmlns:xsi,attr"`

Why remove this? It is required for requests. (It's also in the
response from GetNetworkConfiguration but is ignorable there I guess.)

You also changed it in the test template (which is copied directly
from the msdn web page):

> - <NetworkConfiguration
xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> + <NetworkConfiguration
xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">

[2]

> -func (s *SetNetworkConfiguration) Serialize() (string, error) {
> +func (s *NetworkConfiguration) Serialize() (string, error) {
> return toxml(s) }
>
> +func (s *NetworkConfiguration) Deserialize(data []byte) error { +
> return xml.Unmarshal(data, s) +} +

A small point, but "s" is no longer appropriate.

[3]

> +func (suite *xmlSuite) TestNetworkConfigurationDeserialize(c *C)
> { + // Template from + //
> http://msdn.microsoft.com/en-us/library/windowsazure/jj157181.aspx

You quoted the URL for "set config". I think this should be the "get
config" at:
http://msdn.microsoft.com/en-us/library/windowsazure/jj157196.aspx

Everything else looks good, thanks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHcqY0ACgkQWhGlTF8G/Hcm7gCeIJUSZ1jQYX9dnpvErUAEechu
rZEAnjhnxnaeqz0seeYphG1osAwEvn9e
=sfAh
-----END PGP SIGNATURE-----

Revision history for this message
Julian Edwards (julian-edwards) :
review: Needs Information
Revision history for this message
Julian Edwards (julian-edwards) wrote :

Oh you need a checkPathComponents() call in there too.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Ah, no you don't, there's no user-passed components.

178. By Gavin Panella

Use a more appropriate receiver name.

179. By Gavin Panella

Fix reference for source of example XML.

Revision history for this message
Gavin Panella (allenap) wrote :

> [1]
>
> > -type SetNetworkConfiguration struct { -    XMLName
> > xml.Name               `xml:"NetworkConfiguration"` +type
> > NetworkConfiguration struct { XMLNS               string
> > `xml:"xmlns,attr"` -    XMLNS_XSI           string
> > `xml:"xmlns:xsi,attr"`
>
> Why remove this? It is required for requests. (It's also in the
> response from GetNetworkConfiguration but is ignorable there I guess.)

It's not needed because that namespace is not being used anywhere.
Given that things work fine without it, it's just noise.

>
> You also changed it in the test template (which is copied directly
> from the msdn web page):
>
> > - <NetworkConfiguration
> xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguratio
> n"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > + <NetworkConfiguration
> xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguratio
> n">

I guess I could leave this in, but I've removed it elsewhere. Again,
this namespace is there so that the document can declare where to find
its schema definition, but (a) it doesn't bother to do so, and (b)
we're not validating anyway. Even if MS do suddenly start declaring
which schema to apply we can safely ignore it.

>
> [2]
>
> > -func (s *SetNetworkConfiguration) Serialize() (string, error) {
> > +func (s *NetworkConfiguration) Serialize() (string, error) {
> > return toxml(s) }
> >
> > +func (s *NetworkConfiguration) Deserialize(data []byte) error { +
> > return xml.Unmarshal(data, s) +} +
>
> A small point, but "s" is no longer appropriate.

Oh yes.

>
> [3]
>
> > +func (suite *xmlSuite) TestNetworkConfigurationDeserialize(c *C)
> > { +    // Template from +    //
> > http://msdn.microsoft.com/en-us/library/windowsazure/jj157181.aspx
>
> You quoted the URL for "set config". I think this should be the "get
> config" at:
> http://msdn.microsoft.com/en-us/library/windowsazure/jj157196.aspx

Oops, thanks. Fwiw, the examples are the same (I think).

>
> Everything else looks good, thanks!

Thanks for the review!

Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: