Code Monkey home page Code Monkey logo

azure / azure-sdk-for-go Goto Github PK

View Code? Open in Web Editor NEW
1.6K 314.0 804.0 308.64 MB

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:

Home Page: https://docs.microsoft.com/azure/developer/go/

License: MIT License

Go 94.13% Shell 0.03% PowerShell 5.35% Batchfile 0.01% CSS 0.05% JavaScript 0.07% Smarty 0.03% Dockerfile 0.01% Bicep 0.32%
azure go rest azure-sdk microsoft golang sdk hacktoberfest

azure-sdk-for-go's Issues

Add history on changes over http and tls package

Inside the core folder, there are two folders: http and tls, which are forks of the stdlib packages. It would be really nice to have the initial go version there where it diverged, as well as some comments on what has changed.

How do you plan on keeping those packages up to date?

Maybe adding the initial go version and then reapplying the current changes, so the diff is easier to spot, and also it will be easier to port new changes.

storage/blobutil package to make it easy to upload blobs

We recently removed helper methods from storage/blob pkg so that users won't be fooled by methods containing special client-side logic.

Now we must have a good client library for handling blob uploads (typically block blobs) from user's point of view easily.

Main areas for consideration for PutBlob() functionality (We must write logic to handle these cases):

  1. Block ID generation strategy for multi-block blobs.
  2. Uploading blocks (chunks) concurrently in runtime.NumCPU goroutines (io efficiency)
  3. Support overwrites (to the entire blob)
  4. If blob is small enough, we may as well rely on single PutBlob call rather than bunch of PutBlocks; then PutBlockList
  5. Handle large blob uploads (limit data stored in-memory, accept io.ReadCloser)

cc: @paulmey wdyt?

Error trying to add a disk to a deployment...

The XML looks just fine, but still I receive the following error: The specified disk size value of 0 GB is invalid. Disk size must be between 1 GB and 1023 GB.

Strange enough the call itself looks just fine, so doubt if it's related to the SDK but wouldn't know what else it could be:

REQUEST: POST /<xxx>/services/hostedservices/sander-linux1/deployments HTTP/1.1
Host: management.core.windows.net
Content-Type: application/xml
User-Agent: azure-sdk-for-go
X-Ms-Version: 2014-10-01

<Deployment
    xmlns="http://schemas.microsoft.com/windowsazure">
    <Name>sander-linux1</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>sander-linux1</Label>
    <RoleList>
        <Role>
            <RoleName>sander-linux1</RoleName>
            <RoleType>PersistentVMRole</RoleType>
            <ConfigurationSets>
                <ConfigurationSet>
                    <ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
                    <HostName>sander-linux1</HostName>
                    <UserName>sander</UserName>
                    <UserPassword>xxx</UserPassword>
                    <DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
                </ConfigurationSet>
                <ConfigurationSet>
                    <InputEndpoints>
                        <InputEndpoint>
                            <LocalPort>22</LocalPort>
                            <Name>SSH</Name>
                            <Port>22</Port>
                            <Protocol>TCP</Protocol>
                        </InputEndpoint>
                    </InputEndpoints>
                    <SubnetNames>
                        <SubnetName>test</SubnetName>
                    </SubnetNames>
                    <NetworkSecurityGroup>sandergroep2</NetworkSecurityGroup>
                </ConfigurationSet>
            </ConfigurationSets>
            <DataVirtualHardDisks>
                <DataVirtualHardDisk>
                    <DiskLabel>disk1</DiskLabel>
                    <HostCaching>None</HostCaching>
                    <MediaLink>xxx.blob.core.windows.net/disks/disk1.vhd</MediaLink>
                    <Lun>0</Lun>
                    <LogicalDiskSizeInGB>12</LogicalDiskSizeInGB>
                </DataVirtualHardDisk>
            </DataVirtualHardDisks>
            <OSVirtualHardDisk>
                <MediaLink>http://xxx.blob.core.windows.net/vhds/Ubuntu Server 14.04 LTS.vhd</MediaLink>
                <SourceImageName>b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140414-en-us-30GB</SourceImageName>
            </OSVirtualHardDisk>
            <RoleSize>Basic_A1</RoleSize>
            <ProvisionGuestAgent>true</ProvisionGuestAgent>
        </Role>
    </RoleList>
    <VirtualNetworkName>sandernet</VirtualNetworkName>
</Deployment>

Add User-Agent header

We must add User-Agent header while making queries to management APIs. It should be configurable but should have a default. We can get the UA convention from other language sdks we have.

Consider having a stateful client object

I know the current design is similar in design to the node CLI tools, but I'd like to open up a discussion about moving to having a stateful client object which represents the subscription currently being worked on and has methods for the various operations.

This would greatly assist automation which affects multiple subscriptions simultaneously (which at the moment would need to be in separate processes). It's a fairly significant refactoring, I can dedicate some time to looking at it if the consensus is that it's desirable however.

Support for setting blob properties

It doesn't look like the current library supports setting blob properties. Ensuring that the Cache-Control and Content-Type properties are set correctly is an important use case when using Azure CDN to serve content from Blob Storage.

Confusing error message upon 400 Bad Request

I am using the StorageAccountsClient to create a new Storage Account. It's working pretty well in most cases. However, in case wrong values are passed e.g. wrong location (uswest instead of westus), the SDK throws an error message of the type:

autorest.Client:ShouldPoll Response to https://management.azure.com/subscriptions/ddc30f29-****-****-****-********/resourceGroups/vivekrg1/providers/Microsoft.Storage/storageAccounts/vivekst?api-version=2015-05-01-preview requires polling but polling is disabled

It would be nice for the SDK to bail out with the actual error message e.g. 400 Bad Request. Invalid Location.

Here is the code snippet being used:

cp := storage.StorageAccountCreateParameters{}
cp.Location = location
cp.Properties.AccountType = t

smc := p.StorageAccountsClient(subID)
smc.PollingMode = autorest.PollUntilDuration
smc.PollingDuration = 15 * time.Minute

sa, err := smc.Create(resGroupName, storageAccountName, cp)
if err != nil {
    return nil, err
}
return &sa, nil

Btw: Thanks for adding the ARM support. Cool stuff.

Testing

Currently as I'm implementing new features I'm writing local test harnesses. What is the current testing story to get these more automated?

Add support for additional Azure environment endpoints

Should include support for additional Service Management endpoints for both Azure Government and Azure China. Constants block should include those endpoints.

const (
    paramNotSpecifiedError = "Parameter %s is not specified."

    azureManagementDnsName           = "https://management.core.windows.net"
    azureGovernmentManagementDnsName = "https://management.core.us-govcloudapi.net"
    azureChinaManagementDnsName      = "https://management.core.chinacloudapi.cn"
    msVersionHeader                  = "x-ms-version"
    msVersionHeaderValue             = "2014-05-01"
    contentHeader                    = "Content-Type"
    defaultContentHeaderValue        = "application/xml"
    requestIdHeader                  = "X-Ms-Request-Id"
)

Will be best to wait until #39 is merged before making this add. The NewClient functions could include some sort of Environment argument to denote which environment should be used.

Input validation functions for specific parameter sets.

The way strings are used for some options which have a finite set of possible inputs (ex: storage service types), makes it very inconvenient for people writing software that takes input directly from users.

I propose the implementation of functions which either take individual configuration options (ex: storageservice.ValidateAccountType), or for the whole structs used for passing parameters to the various CRUD functions already implemented (ex: storageservice.ValidateStorageServiceCreateParameters).

I'd be more than glad to do it myself (as I've already inlined most of it in my project before deciding people might need these and try and get them into the sdk).

Only points I'd like discussed more thoroughly is:

  • should validation be preffered per option, or per configuration set (see above storage service type example)?
  • should they be put in their own package (ex: azure-sdk-for-go/validation), or put in their respective packages?
  • should it be preferred to make API calls for getting the reference values (ex: location.ListLocations() and use that as the baseline), or have the values "hard-coded", as it were, in the functions themselves?

Dealing with some benign errors

When a call returns UnexpectedStatusCodeError, there is no programatic way to tell what status code was actually return to let the user code decide how to proceed.

solution proposed is to expose .Got() (returning .got)

An example scenario: when creating a queue that already exist, user code might decide this is fine, but have no way to be sure of that. The Queue service doc say in this case the response is 204, the following code is possible with the suggestion solution:

qc := az.GetQueueService()

err = qc.CreateQueue(queueName)
if storageError, ok := err.(*storage.UnexpectedStatusCodeError); ok {
    if storageError.Got() != http.StatusNoContent {
        panic(err)
    }
}

qc.GetMessages(queueName, storage.GetMessagesParameters{})

Backlog?

I was wondering if there is a prioritized backlog for this that I can take a look at to see what features are being worked on or planned?
I don't want to start something when someone else is already working on it

Thanks,

Import PublishSettings from File

It seems that there's a private function for importing the publishsetting file
[https://github.com/MSOpenTech/azure-sdk-for-go/blob/master/management/publishSettings.go#L31]

But I can't find another function that use the private function. Will it be public or have a NewClientFromPublishSettingsFile constructor?

storage/blob: Remove PutBlockBlob

putBlockBlob/PutBlockBlob methods are convenience methods with special logic and we shouldn't have those in the same package (maybe move to blobhelper).

go-get problem: no buildable Go source files in the repo

I try to run go get github.com/MSOpenTech/azure-sdk-for-go as it is written in README file, but I get following error message:

β†’ go get github.com/MSOpenTech/azure-sdk-for-go
can't load package: package github.com/MSOpenTech/azure-sdk-for-go: no buildable Go source files in /Users/allomov/work/altoros/microbosh/go/src/github.com/MSOpenTech/azure-sdk-for-go

Creating a VM from a VM image fails with "In order to use extension reference, ProvisionGuestAgent must be set during virtual machine provisioning."

From the integration tests:

github.com\Azure\azure-sdk-for-go\management\vmutils>go test -timeout 30m .
--- FAIL: TestDeployFromVmImage (39.22s)
        integration_test.go:208: Retrieving storage account
        managementclient.go:51: AZURE: GET services/storageservices
        managementclient.go:55:    <<< <StorageServices xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><StorageService><Url>https://management.core.windows.net/c33f5e65-247c-4819-8bcc-0cb2c3b354df/services/storageservices/pmtest1451430345676939</Url><ServiceName>pmtest1451430345676939</ServiceName><StorageServiceProperties><Description i:nil="true"/><Location>East US 2</Location><Label>cG10ZXN0MTQ1MTQzMDM0NTY3NjkzOQ==</Label><Status>Created</Status><Endpoints><Endpoint>https://pmtest1451430345676939.blob.core.windows.net/</Endpoint><Endpoint>https://pmtest1451430345676939.queue.core.windows.net/</Endpoint><Endpoint>https://pmtest1451430345676939.table.core.windows.net/</Endpoint></Endpoints><GeoPrimaryRegion>East US 2</GeoPrimaryRegion><StatusOfPrimary>Available</StatusOfPrimary><GeoSecondaryRegion/><StatusOfSecondary/><CreationTime>2015-04-29T22:14:38Z</CreationTime><CustomDomains/><AccountType>Standard_LRS</AccountType></StorageServiceProperties><ExtendedProperties><ExtendedProperty><Name>ResourceGroup</Name><Value>Default-Storage-EastUS2</Value></ExtendedProperty><ExtendedProperty><Name>ResourceLocation</Name><Value>East US 2</Value></ExtendedProperty></ExtendedProperties></StorageService><StorageService><Url>https://management.core.windows.net/c33f5e65-247c-4819-8bcc-0cb2c3b354df/services/storageservices/pmwus123</Url><ServiceName>pmwus123</ServiceName><StorageServiceProperties><Description i:nil="true"/><Location>West US</Location><Label>cG13dXMxMjM=</Label><Status>Created</Status><Endpoints><Endpoint>https://pmwus123.blob.core.windows.net/</Endpoint><Endpoint>https://pmwus123.queue.core.windows.net/</Endpoint><Endpoint>https://pmwus123.table.core.windows.net/</Endpoint></Endpoints><GeoPrimaryRegion>West US</GeoPrimaryRegion><StatusOfPrimary>Available</StatusOfPrimary><GeoSecondaryRegion>East US</GeoSecondaryRegion><StatusOfSecondary>Available</StatusOfSecondary><CreationTime>2015-04-02T21:58:38Z</CreationTime><CustomDomains/><AccountType>Standard_GRS</AccountType></StorageServiceProperties><ExtendedProperties><ExtendedProperty><Name>ResourceGroup</Name><Value>Default-Storage-WestUS</Value></ExtendedProperty><ExtendedProperty><Name>ResourceLocation</Name><Value>West US</Value></ExtendedProperty></ExtendedProperties></StorageService><StorageService><Url>https://management.core.windows.net/c33f5e65-247c-4819-8bcc-0cb2c3b354df/services/storageservices/portalvhdsw6j5mnbx6qmy</Url><ServiceName>portalvhdsw6j5mnbx6qmy</ServiceName><StorageServiceProperties><Description>Implicitly created storage service</Description><Location>South Central US</Location><Label>cG9ydGFsdmhkc3c2ajVtbmJ4NnFteQ==</Label><Status>Created</Status><Endpoints><Endpoint>https://portalvhdsw6j5mnbx6qmy.blob.core.windows.net/</Endpoint><Endpoint>https://portalvhdsw6j5mnbx6qmy.queue.core.windows.net/</Endpoint><Endpoint>https://portalvhdsw6j5mnbx6qmy.table.core.windows.net/</Endpoint></Endpoints><GeoPrimaryRegion>South Central US</GeoPrimaryRegion><StatusOfPrimary>Available</StatusOfPrimary><GeoSecondaryRegion>North Central US</GeoSecondaryRegion><StatusOfSecondary>Available</StatusOfSecondary><CreationTime>2015-04-13T22:44:53Z</CreationTime><CustomDomains/><AccountType>Standard_GRS</AccountType></StorageServiceProperties><ExtendedProperties><ExtendedProperty><Name>ResourceGroup</Name><Value>Default-Storage-SouthCentralUS</Value></ExtendedProperty><ExtendedProperty><Name>ResourceLocation</Name><Value>South Central US</Value></ExtendedProperty></ExtendedProperties></StorageService><StorageService><Url>https://management.core.windows.net/c33f5e65-247c-4819-8bcc-0cb2c3b354df/services/storageservices/sdkih3l426kgf5o</Url><ServiceName>sdkih3l426kgf5o</ServiceName><StorageServiceProperties><Description i:nil="true"/><Location>East Asia</Location><Label>c2RraWgzbDQyNmtnZjVv</Label><Status>Created</Status><Endpoints><Endpoint>https://sdkih3l426kgf5o.blob.core.windows.net/</Endpoint><Endpoint>https://sdkih3l426kgf5o.queue.core.windows.net/</Endpoint><Endpoint>https://sdkih3l426kgf5o.table.core.windows.net/</Endpoint></Endpoints><GeoPrimaryRegion>East Asia</GeoPrimaryRegion><StatusOfPrimary>Available</StatusOfPrimary><GeoSecondaryRegion/><StatusOfSecondary/><CreationTime>2015-03-26T17:04:52Z</CreationTime><CustomDomains/><AccountType>Standard_LRS</AccountType></StorageServiceProperties><ExtendedProperties><ExtendedProperty><Name>ResourceGroup</Name><Value>Default-Storage-EastAsia</Value></ExtendedProperty><ExtendedProperty><Name>ResourceLocation</Name><Value>East Asia</Value></ExtendedProperty></ExtendedProperties></StorageService></StorageServices>
        integration_test.go:246: Selected storage account 'portalvhdsw6j5mnbx6qmy' in location 'South Central US'
        integration_test.go:298: Selecting VM image
        managementclient.go:51: AZURE: GET services/vmimages
        managementclient.go:55:    <<< <VMImages xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><VMImage><Name>PackerMade_OpenLogicImage_2015-April-25_0-10</Name><Label>PackerMade_OpenLogicImage</Label><Category>User</Category><Description>paker made image</Description><OSDiskConfiguration><Name>PackerMade_OpenLogicImage_2015-April-25_0-10-os-2015-04-25</Name><HostCaching>ReadWrite</HostCaching><OSState>Generalized</OSState><OS>Linux</OS><MediaLink>https://pmwus123.blob.core.windows.net/images/PackerMade_OpenLogicImage_2015-April-25_0-10-os-2015-04-25.vhd</MediaLink><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><IOType>Standard</IOType></OSDiskConfiguration><DataDiskConfigurations/><ServiceName>PkrSrvnc5e26lzke</ServiceName><DeploymentName>PkrVMnc5e26lzke</DeploymentName><RoleName>PkrVMnc5e26lzke</RoleName><Location>West US</Location><CreatedTime>2015-04-25T07:16:03.3432256Z</CreatedTime><ModifiedTime>2015-04-25T07:16:03.3432256Z</ModifiedTime><ImageFamily>PackerMade</ImageFamily><RecommendedVMSize>Small</RecommendedVMSize><IsPremium>false</IsPremium><VMImageState>VMImageReadyForUse</VMImageState><RoleStateOnCapture>StoppedVM</RoleStateOnCapture><RoleSizeOnCapture>Small</RoleSizeOnCapture></VMImage><VMImage><Name>PackerMade_OpenLogicImage_2015-April-25_19-40</Name><Label>PackerMade_OpenLogicImage</Label><Category>User</Category><Description>paker made image</Description><OSDiskConfiguration><Name>PackerMade_OpenLogicImage_2015-April-25_19-40-os-2015-04-26</Name><HostCaching>ReadWrite</HostCaching><OSState>Generalized</OSState><OS>Linux</OS><MediaLink>https://pmwus123.blob.core.windows.net/images/PackerMade_OpenLogicImage_2015-April-25_19-40-os-2015-04-26.vhd</MediaLink><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><IOType>Standard</IOType></OSDiskConfiguration><DataDiskConfigurations/><ServiceName>PkrSrv80big2920y</ServiceName><DeploymentName>PkrVM80big2920y</DeploymentName><RoleName>PkrVM80big2920y</RoleName><Location>West US</Location><CreatedTime>2015-04-26T02:45:46.8813467Z</CreatedTime><ModifiedTime>2015-04-26T02:45:46.8813467Z</ModifiedTime><ImageFamily>PackerMade</ImageFamily><RecommendedVMSize>Small</RecommendedVMSize><IsPremium>false</IsPremium><VMImageState>VMImageReadyForUse</VMImageState><RoleStateOnCapture>StoppedVM</RoleStateOnCapture><RoleSizeOnCapture>Small</RoleSizeOnCapture></VMImage><VMImage><Name>PackerMade_OpenLogicImage_2015-April-2_17-21</Name><Label>PackerMade_OpenLogicImage</Label><Category>User</Category><Description>paker made image</Description><OSDiskConfiguration><Name>PackerMade_OpenLogicImage_2015-April-2_17-21-os-2015-04-03</Name><HostCaching>ReadWrite</HostCaching><OSState>Generalized</OSState><OS>Linux</OS><MediaLink>https://pmwus123.blob.core.windows.net/images/PackerMade_OpenLogicImage_2015-April-2_17-21-os-2015-04-03.vhd</MediaLink><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><IOType>Standard</IOType></OSDiskConfiguration><DataDiskConfigurations/><ServiceName>PkrSrvtnpnhpozbd</ServiceName><DeploymentName>PkrVMtnpnhpozbd</DeploymentName><RoleName>PkrVMtnpnhpozbd</RoleName><Location>West US</Location><CreatedTime>2015-04-03T00:51:27.2841004Z</CreatedTime><ModifiedTime>2015-04-03T00:51:27.2841004Z</ModifiedTime><ImageFamily>PackerMade</ImageFamily><RecommendedVMSize>Small</RecommendedVMSize><IsPremium>false</IsPremium><VMImageState>VMImageReadyForUse</VMImageState><RoleStateOnCapture>StoppedVM</RoleStateOnCapture><RoleSizeOnCapture>Small</RoleSizeOnCapture></VMImage><VMImage><Name>PackerMade_OpenLogicImage_2015-April-2_18-2</Name><Label>PackerMade_OpenLogicImage</Label><Category>User</Category><Description>paker made image</Description><OSDiskConfiguration><Name>PackerMade_OpenLogicImage_2015-April-2_18-2-os-2015-04-03</Name><HostCaching>ReadWrite</HostCaching><OSState>Generalized</OSState><OS>Linux</OS><MediaLink>https://pmwus123.blob.core.windows.net/images/PackerMade_OpenLogicImage_2015-April-2_18-2-os-2015-04-03.vhd</MediaLink><LogicalDiskSizeInGB>30</LogicalDiskSizeInGB><IOType>Standard</IOType></OSDiskConfiguration><DataDiskConfigurations/><ServiceName>PkrSrv24voud9zhz</ServiceName><DeploymentName>PkrVM24voud9zhz</DeploymentName><RoleName>PkrVM24voud9zhz</RoleName><Location>West US</Location><CreatedTime>2015-04-03T01:32:55.6802049Z</CreatedTime><ModifiedTime>2015-04-03T01:32:55.6802049Z</ModifiedTime><ImageFamily>PackerMade</ImageFamily><RecommendedVMSize>Small</RecommendedVMSize><IsPremium>false</IsPremium><VMImageState>VMImageReadyForUse</VMImageState><RoleStateOnCapture>StoppedVM</RoleStateOnCapture><RoleSizeOnCapture>Small</RoleSizeOnCapture></VMImage><VMImage><Name>PackerMade_OpenLogicImage_2015-April-3_10-54</Name><Label>PackerMade_OpenLogicImage</Label><Category>User</Category><Description>paker made image</Description><OSDiskConfiguration><Name>PackerMade_OpenLogicImage_2015-April-3_10-54-os-2015-04-03</Name><HostCaching>ReadWrite</HostCaching><OSState>Generalized</OSState><OS>Linux</OS><MediaLink>https://pmwus123.blob.core.windows.net/images/P...
        integration_test.go:320: Selecting image 'fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014-RTM-12.0.2430.0-OLTP-ENU-Win2012R2-cy14su11'
        managementclient.go:79: AZURE: POST services/hostedservices
        managementclient.go:81:    >>> <CreateHostedService xmlns="http://schemas.microsoft.com/windowsazure"><ServiceName>sdk4cv1aadeyjs0</ServiceName><Label>c2RrNGN2MWFhZGV5anMw</Label><Description></Description><Location>South Central US</Location></CreateHostedService>
        managementclient.go:86:    <<< OperationID: a148ce88768ea25b9ff184c4f880b723
        managementclient.go:79: AZURE: POST services/hostedservices/sdk4cv1aadeyjs0/deployments
        managementclient.go:81:    >>> <Deployment xmlns="http://schemas.microsoft.com/windowsazure"><Name>sdk4cv1aadeyjs0</Name><DeploymentSlot>Production</DeploymentSlot><Label>sdk4cv1aadeyjs0</Label><RoleList><Role><RoleName>sdk4cv1aadeyjs0</RoleName><RoleType>PersistentVMRole</RoleType><ConfigurationSets><ConfigurationSet><ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType><ComputerName>sdk4cv1aadeyjs0</ComputerName><AdminPassword>cdtbdurphrtjlEFEXMSQCDTBDURPHRTJL32165337402830006484efexms</AdminPassword><EnableAutomaticUpdates>true</EnableAutomaticUpdates><StoredCertificateSettings></StoredCertificateSettings><AdminUsername>azureuser</AdminUsername><InputEndpoints></InputEndpoints><SubnetNames></SubnetNames><PublicIPs></PublicIPs></ConfigurationSet><ConfigurationSet><ConfigurationSetType>NetworkConfiguration</ConfigurationSetType><StoredCertificateSettings></StoredCertificateSettings><InputEndpoints><InputEndpoint><LocalPort>22</LocalPort><Name>SSH</Name><Port>22</Port><Protocol>TCP</Protocol></InputEndpoint></InputEndpoints><SubnetNames></SubnetNames><PublicIPs></PublicIPs></ConfigurationSet></ConfigurationSets><ResourceExtensionReferences></ResourceExtensionReferences><VMImageName>fb83b3509582419d99629ce476bcb5c8__SQL-Server-2014-RTM-12.0.2430.0-OLTP-ENU-Win2012R2-cy14su11</VMImageName><MediaLocation>http://portalvhdsw6j5mnbx6qmy.blob.core.windows.net/sdk4cv1aadeyjs0</MediaLocation><DataVirtualHardDisks></DataVirtualHardDisks><RoleSize>Standard_D4</RoleSize></Role></RoleList><Dns><DnsServers></DnsServers></Dns><LoadBalancers></LoadBalancers></Deployment>
        managementclient.go:84:    <<< ERROR: Error response from Azure. Code: BadRequest, Message: In order to use extension reference, ProvisionGuestAgent must be set during virtual machine provisioning.
        integration_test.go:192: Error response from Azure. Code: BadRequest, Message: In order to use extension reference, ProvisionGuestAgent must be set during virtual machine provisioning.
        integration_test.go:197: Deleting hosted service: sdk4cv1aadeyjs0
        managementclient.go:79: AZURE: DELETE services/hostedservices/sdk4cv1aadeyjs0?comp=media
        managementclient.go:86:    <<< OperationID: 0d68e388b0f6a7c6b0d194a3f161785d
FAIL

Return response structs from methods

There are still a few methods on the SDK where the return values from the operations are stripped down into more basic types like string or slice. That damages extensibility (without breaking) and introduces inconsistencies.

Ideally a method must map 1:1 to a REST API call and should be like

func(f FooClient)VerbBar([r requiredParams...], params VerbBarParams) (VerbBarResponse, error)

in the schema above adding things to VerbBarParams (e.g. CreateDeploymentParameters) and VerbBarResponse (e.g. ListHostedServicesResponse) can be done without breaking the caller.

requiredParams must be list of arguments that don't go into the XML request body but rather used in constructing the REST API request URL. Those must be validated. But we must not validate the arguments in params structs if they're required or not on the client side (because REST API already does that.)

Opening this issue as a cleanup task.
cc: @paulmey

Eliminate stdlib forks living at core/

core/ currently has net/http and crypto/tls vendored (with some changes we don't entirely know). We must watch out if we can make feature requests to golang about these and eventually get rid of those (nobody will vendor our entire repo like this) πŸ˜„

management.NewClientFromPublishSettings is undefined

According to README.md
We can use

client, err := management.NewClientFromPublishSettings(SUBSCRIPTION_ID, SUBSCRIPTION_CERTIFICATE)
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }

to create a client.

But NewClientFromPublishSettings is undefined.

Remove Logic from Hosted Service Client

When creating a hosted service, there is a call made to check the name availability. My opinion is that we should remove this call and make it a user responsibility, since they have to handle the ConflictError which can result from the race between checking the availability and creating the hosted service.

However, the check being present makes it very difficult to find out what actual error gets returned if you hit the race condition!

Feature request: Support for traffic manager / Load balancer

We have a use case where we'd like to use Terraform to create traffic managers / load balancers in Azure. To support this we need this client library to support it, so terraform can then support it via the stable library that it currently depends on.

I've seen mention in some of the other issues of a auto API code generation, does that mean that you wouldn't accept a PR to add this?

OSimage get operation fails.

The osimage.Client.GetImageList() operation consistently fails with:

Get https://management.core.windows.net/<my-subscription-id>/services/images: local error: internal error

ARM REST methods fail on 201 response

I am testing out the ARM APIs, and have observed frequent (but not 100%) failures from methods due to "201 Created" being returned (e.g. by ResourceGroupsClient.CreateOrUpdate).

Looking at the code, I think the second-last "autorest.Respond" in each method that expects status codes other than 200 is invalid: in each, it uses WithErrorUnlessOK; I think it should be using WithErrorUnlessStatusCode, with the same values passed into DoErrorUnlessStatusCode in the SendWithSender call above.

Remove XMLName from returned response structs

I see quite many XMLName fields in response structs returned from client methods. These are not particularly useful to the user and they're confusing. Let's get rid of those –––assuming they're not needed for parsing those structs with encoding/xml.

cc: @paulmey

Explain fork of http and tls in azure sdk

It looks like net/http and crypto/tls have been forked for use in the SDK. It would be nice to get an overview of why this was done, what changes were made and a road map to get the required changes into Go standard library, if possible.

The worry here is that it will be hard to vet the implementation for security and problematic to ensure fixes are backported from the standard library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.