mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #30091 from rootfs/azure-storage
Automatic merge from submit-queue
support Azure disk dynamic provisioning
azure disk dynamic provisioning
A screen shot 
``` console
$ kubectl create -f examples/experimental/persistent-volume-provisioning/azure-dd.yaml
storageclass "slow" created
$ kubectl create -f examples/experimental/persistent-volume-provisioning/claim1.json
persistentvolumeclaim "claim1" created
$ kubectl describe pvc
Name:       claim1
Namespace:  default
Status:     Bound
Volume:     pvc-de7150d1-6a37-11e6-aec9-000d3a12e034
Labels:     <none>
Capacity:   3Gi
Access Modes:   RWO
$ kubectl create -f pod.yaml
replicationcontroller "nfs-server" created
$ kubectl describe pod
Name:       nfs-server-b9w6x
Namespace:  default
Node:       rootfs-dev/172.24.0.4
Start Time: Wed, 24 Aug 2016 19:46:21 +0000
Labels:     role=nfs-server
Status:     Running
IP:     172.17.0.2
Controllers:    ReplicationController/nfs-server
Containers:
  nfs-server:
    Container ID:   docker://be6f8c0e26dc896d4c53ef0d21c9414982f0b39a10facd6b93a255f9e1c3806c
    Image:      nginx
    Image ID:       docker://bfdd4ced794ed276a28cf56b233ea58dec544e9ca329d796cf30b8bcf6d39b3f
    Port:       
    State:      Running
      Started:      Wed, 24 Aug 2016 19:49:19 +0000
    Ready:      True
    Restart Count:  0
    Volume Mounts:
      /exports from mypvc (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-9o0fj (ro)
    Environment Variables:  <none>
Conditions:
  Type      Status
  Initialized   True 
  Ready     True 
  PodScheduled  True 
Volumes:
  mypvc:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  claim1
    ReadOnly:   false
  default-token-9o0fj:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-9o0fj
QoS Class:  BestEffort
Tolerations:    <none>
Events:
  FirstSeen LastSeen    Count   From            SubobjectPath           Type        Reason      Message
  --------- --------    -----   ----            -------------           --------    ------      -------
  11m       11m     1   {default-scheduler }                    Normal      Scheduled   Successfully assigned nfs-server-b9w6x to rootfs-dev
  9m        9m      1   {kubelet rootfs-dev}                    Warning     FailedMount Unable to mount volumes for pod "nfs-server-b9w6x_default(6eb7fd98-6a33-11e6-aec9-000d3a12e034)": timeout expired waiting for volumes to attach/mount for pod "nfs-server-b9w6x"/"default". list of unattached/unmounted volumes=[mypvc]
  9m        9m      1   {kubelet rootfs-dev}                    Warning     FailedSync  Error syncing pod, skipping: timeout expired waiting for volumes to attach/mount for pod "nfs-server-b9w6x"/"default". list of unattached/unmounted volumes=[mypvc]
  8m        8m      1   {kubelet rootfs-dev}    spec.containers{nfs-server} Normal      Pulling     pulling image "nginx"
  8m        8m      1   {kubelet rootfs-dev}    spec.containers{nfs-server} Normal      Pulled      Successfully pulled image "nginx"
  8m        8m      1   {kubelet rootfs-dev}    spec.containers{nfs-server} Normal      Created     Created container with docker id be6f8c0e26dc
  8m        8m      1   {kubelet rootfs-dev}    spec.containers{nfs-server} Normal      Started     Started container with docker id be6f8c0e26dc
```
@colemickens @brendandburns
			
			
This commit is contained in:
		
							
								
								
									
										22
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										22
									
								
								Godeps/Godeps.json
									
									
									
										generated
									
									
									
								
							@@ -30,13 +30,23 @@
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/compute",
 | 
			
		||||
			"Comment": "v3.0.0-beta",
 | 
			
		||||
			"Rev": "2cdbb8553a20830507e4178b4d0803794136dde7"
 | 
			
		||||
			"Comment": "v3.2.0-beta",
 | 
			
		||||
			"Rev": "8316b9060f9c2443ba0864663245695d570a7fa2"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/network",
 | 
			
		||||
			"Comment": "v3.0.0-beta",
 | 
			
		||||
			"Rev": "2cdbb8553a20830507e4178b4d0803794136dde7"
 | 
			
		||||
			"Comment": "v3.2.0-beta",
 | 
			
		||||
			"Rev": "8316b9060f9c2443ba0864663245695d570a7fa2"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/storage",
 | 
			
		||||
			"Comment": "v3.2.0-beta",
 | 
			
		||||
			"Rev": "8316b9060f9c2443ba0864663245695d570a7fa2"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/Azure/azure-sdk-for-go/storage",
 | 
			
		||||
			"Comment": "v3.2.0-beta",
 | 
			
		||||
			"Rev": "8316b9060f9c2443ba0864663245695d570a7fa2"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/Azure/go-ansiterm",
 | 
			
		||||
@@ -2071,6 +2081,10 @@
 | 
			
		||||
			"Comment": "v1-40-g783cfcb",
 | 
			
		||||
			"Rev": "783cfcb01fb00c48f740c9de79122bd410294149"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/rubiojr/go-vhd/vhd",
 | 
			
		||||
			"Rev": "0bfd3b39853cdde5762efda92289f14b0ac0491b"
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"ImportPath": "github.com/russross/blackfriday",
 | 
			
		||||
			"Comment": "v1.4-2-g300106c",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										458
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										458
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							@@ -7646,7 +7646,7 @@ SOFTWARE.
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright [yyyy] [name of copyright owner]
 | 
			
		||||
   Copyright 2016 Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
@@ -7660,7 +7660,7 @@ SOFTWARE.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE 3b83ef96387f14655fc854ddc3c6bd57  -
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -7856,7 +7856,7 @@ SOFTWARE.
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright [yyyy] [name of copyright owner]
 | 
			
		||||
   Copyright 2016 Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
@@ -7870,7 +7870,427 @@ SOFTWARE.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE 3b83ef96387f14655fc854ddc3c6bd57  -
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/arm/storage licensed under: =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                 Apache License
 | 
			
		||||
                           Version 2.0, January 2004
 | 
			
		||||
                        http://www.apache.org/licenses/
 | 
			
		||||
 | 
			
		||||
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 | 
			
		||||
 | 
			
		||||
   1. Definitions.
 | 
			
		||||
 | 
			
		||||
      "License" shall mean the terms and conditions for use, reproduction,
 | 
			
		||||
      and distribution as defined by Sections 1 through 9 of this document.
 | 
			
		||||
 | 
			
		||||
      "Licensor" shall mean the copyright owner or entity authorized by
 | 
			
		||||
      the copyright owner that is granting the License.
 | 
			
		||||
 | 
			
		||||
      "Legal Entity" shall mean the union of the acting entity and all
 | 
			
		||||
      other entities that control, are controlled by, or are under common
 | 
			
		||||
      control with that entity. For the purposes of this definition,
 | 
			
		||||
      "control" means (i) the power, direct or indirect, to cause the
 | 
			
		||||
      direction or management of such entity, whether by contract or
 | 
			
		||||
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
 | 
			
		||||
      outstanding shares, or (iii) beneficial ownership of such entity.
 | 
			
		||||
 | 
			
		||||
      "You" (or "Your") shall mean an individual or Legal Entity
 | 
			
		||||
      exercising permissions granted by this License.
 | 
			
		||||
 | 
			
		||||
      "Source" form shall mean the preferred form for making modifications,
 | 
			
		||||
      including but not limited to software source code, documentation
 | 
			
		||||
      source, and configuration files.
 | 
			
		||||
 | 
			
		||||
      "Object" form shall mean any form resulting from mechanical
 | 
			
		||||
      transformation or translation of a Source form, including but
 | 
			
		||||
      not limited to compiled object code, generated documentation,
 | 
			
		||||
      and conversions to other media types.
 | 
			
		||||
 | 
			
		||||
      "Work" shall mean the work of authorship, whether in Source or
 | 
			
		||||
      Object form, made available under the License, as indicated by a
 | 
			
		||||
      copyright notice that is included in or attached to the work
 | 
			
		||||
      (an example is provided in the Appendix below).
 | 
			
		||||
 | 
			
		||||
      "Derivative Works" shall mean any work, whether in Source or Object
 | 
			
		||||
      form, that is based on (or derived from) the Work and for which the
 | 
			
		||||
      editorial revisions, annotations, elaborations, or other modifications
 | 
			
		||||
      represent, as a whole, an original work of authorship. For the purposes
 | 
			
		||||
      of this License, Derivative Works shall not include works that remain
 | 
			
		||||
      separable from, or merely link (or bind by name) to the interfaces of,
 | 
			
		||||
      the Work and Derivative Works thereof.
 | 
			
		||||
 | 
			
		||||
      "Contribution" shall mean any work of authorship, including
 | 
			
		||||
      the original version of the Work and any modifications or additions
 | 
			
		||||
      to that Work or Derivative Works thereof, that is intentionally
 | 
			
		||||
      submitted to Licensor for inclusion in the Work by the copyright owner
 | 
			
		||||
      or by an individual or Legal Entity authorized to submit on behalf of
 | 
			
		||||
      the copyright owner. For the purposes of this definition, "submitted"
 | 
			
		||||
      means any form of electronic, verbal, or written communication sent
 | 
			
		||||
      to the Licensor or its representatives, including but not limited to
 | 
			
		||||
      communication on electronic mailing lists, source code control systems,
 | 
			
		||||
      and issue tracking systems that are managed by, or on behalf of, the
 | 
			
		||||
      Licensor for the purpose of discussing and improving the Work, but
 | 
			
		||||
      excluding communication that is conspicuously marked or otherwise
 | 
			
		||||
      designated in writing by the copyright owner as "Not a Contribution."
 | 
			
		||||
 | 
			
		||||
      "Contributor" shall mean Licensor and any individual or Legal Entity
 | 
			
		||||
      on behalf of whom a Contribution has been received by Licensor and
 | 
			
		||||
      subsequently incorporated within the Work.
 | 
			
		||||
 | 
			
		||||
   2. Grant of Copyright License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      copyright license to reproduce, prepare Derivative Works of,
 | 
			
		||||
      publicly display, publicly perform, sublicense, and distribute the
 | 
			
		||||
      Work and such Derivative Works in Source or Object form.
 | 
			
		||||
 | 
			
		||||
   3. Grant of Patent License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      (except as stated in this section) patent license to make, have made,
 | 
			
		||||
      use, offer to sell, sell, import, and otherwise transfer the Work,
 | 
			
		||||
      where such license applies only to those patent claims licensable
 | 
			
		||||
      by such Contributor that are necessarily infringed by their
 | 
			
		||||
      Contribution(s) alone or by combination of their Contribution(s)
 | 
			
		||||
      with the Work to which such Contribution(s) was submitted. If You
 | 
			
		||||
      institute patent litigation against any entity (including a
 | 
			
		||||
      cross-claim or counterclaim in a lawsuit) alleging that the Work
 | 
			
		||||
      or a Contribution incorporated within the Work constitutes direct
 | 
			
		||||
      or contributory patent infringement, then any patent licenses
 | 
			
		||||
      granted to You under this License for that Work shall terminate
 | 
			
		||||
      as of the date such litigation is filed.
 | 
			
		||||
 | 
			
		||||
   4. Redistribution. You may reproduce and distribute copies of the
 | 
			
		||||
      Work or Derivative Works thereof in any medium, with or without
 | 
			
		||||
      modifications, and in Source or Object form, provided that You
 | 
			
		||||
      meet the following conditions:
 | 
			
		||||
 | 
			
		||||
      (a) You must give any other recipients of the Work or
 | 
			
		||||
          Derivative Works a copy of this License; and
 | 
			
		||||
 | 
			
		||||
      (b) You must cause any modified files to carry prominent notices
 | 
			
		||||
          stating that You changed the files; and
 | 
			
		||||
 | 
			
		||||
      (c) You must retain, in the Source form of any Derivative Works
 | 
			
		||||
          that You distribute, all copyright, patent, trademark, and
 | 
			
		||||
          attribution notices from the Source form of the Work,
 | 
			
		||||
          excluding those notices that do not pertain to any part of
 | 
			
		||||
          the Derivative Works; and
 | 
			
		||||
 | 
			
		||||
      (d) If the Work includes a "NOTICE" text file as part of its
 | 
			
		||||
          distribution, then any Derivative Works that You distribute must
 | 
			
		||||
          include a readable copy of the attribution notices contained
 | 
			
		||||
          within such NOTICE file, excluding those notices that do not
 | 
			
		||||
          pertain to any part of the Derivative Works, in at least one
 | 
			
		||||
          of the following places: within a NOTICE text file distributed
 | 
			
		||||
          as part of the Derivative Works; within the Source form or
 | 
			
		||||
          documentation, if provided along with the Derivative Works; or,
 | 
			
		||||
          within a display generated by the Derivative Works, if and
 | 
			
		||||
          wherever such third-party notices normally appear. The contents
 | 
			
		||||
          of the NOTICE file are for informational purposes only and
 | 
			
		||||
          do not modify the License. You may add Your own attribution
 | 
			
		||||
          notices within Derivative Works that You distribute, alongside
 | 
			
		||||
          or as an addendum to the NOTICE text from the Work, provided
 | 
			
		||||
          that such additional attribution notices cannot be construed
 | 
			
		||||
          as modifying the License.
 | 
			
		||||
 | 
			
		||||
      You may add Your own copyright statement to Your modifications and
 | 
			
		||||
      may provide additional or different license terms and conditions
 | 
			
		||||
      for use, reproduction, or distribution of Your modifications, or
 | 
			
		||||
      for any such Derivative Works as a whole, provided Your use,
 | 
			
		||||
      reproduction, and distribution of the Work otherwise complies with
 | 
			
		||||
      the conditions stated in this License.
 | 
			
		||||
 | 
			
		||||
   5. Submission of Contributions. Unless You explicitly state otherwise,
 | 
			
		||||
      any Contribution intentionally submitted for inclusion in the Work
 | 
			
		||||
      by You to the Licensor shall be under the terms and conditions of
 | 
			
		||||
      this License, without any additional terms or conditions.
 | 
			
		||||
      Notwithstanding the above, nothing herein shall supersede or modify
 | 
			
		||||
      the terms of any separate license agreement you may have executed
 | 
			
		||||
      with Licensor regarding such Contributions.
 | 
			
		||||
 | 
			
		||||
   6. Trademarks. This License does not grant permission to use the trade
 | 
			
		||||
      names, trademarks, service marks, or product names of the Licensor,
 | 
			
		||||
      except as required for reasonable and customary use in describing the
 | 
			
		||||
      origin of the Work and reproducing the content of the NOTICE file.
 | 
			
		||||
 | 
			
		||||
   7. Disclaimer of Warranty. Unless required by applicable law or
 | 
			
		||||
      agreed to in writing, Licensor provides the Work (and each
 | 
			
		||||
      Contributor provides its Contributions) on an "AS IS" BASIS,
 | 
			
		||||
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
      implied, including, without limitation, any warranties or conditions
 | 
			
		||||
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
 | 
			
		||||
      PARTICULAR PURPOSE. You are solely responsible for determining the
 | 
			
		||||
      appropriateness of using or redistributing the Work and assume any
 | 
			
		||||
      risks associated with Your exercise of permissions under this License.
 | 
			
		||||
 | 
			
		||||
   8. Limitation of Liability. In no event and under no legal theory,
 | 
			
		||||
      whether in tort (including negligence), contract, or otherwise,
 | 
			
		||||
      unless required by applicable law (such as deliberate and grossly
 | 
			
		||||
      negligent acts) or agreed to in writing, shall any Contributor be
 | 
			
		||||
      liable to You for damages, including any direct, indirect, special,
 | 
			
		||||
      incidental, or consequential damages of any character arising as a
 | 
			
		||||
      result of this License or out of the use or inability to use the
 | 
			
		||||
      Work (including but not limited to damages for loss of goodwill,
 | 
			
		||||
      work stoppage, computer failure or malfunction, or any and all
 | 
			
		||||
      other commercial damages or losses), even if such Contributor
 | 
			
		||||
      has been advised of the possibility of such damages.
 | 
			
		||||
 | 
			
		||||
   9. Accepting Warranty or Additional Liability. While redistributing
 | 
			
		||||
      the Work or Derivative Works thereof, You may choose to offer,
 | 
			
		||||
      and charge a fee for, acceptance of support, warranty, indemnity,
 | 
			
		||||
      or other liability obligations and/or rights consistent with this
 | 
			
		||||
      License. However, in accepting such obligations, You may act only
 | 
			
		||||
      on Your own behalf and on Your sole responsibility, not on behalf
 | 
			
		||||
      of any other Contributor, and only if You agree to indemnify,
 | 
			
		||||
      defend, and hold each Contributor harmless for any liability
 | 
			
		||||
      incurred by, or claims asserted against, such Contributor by reason
 | 
			
		||||
      of your accepting any such warranty or additional liability.
 | 
			
		||||
 | 
			
		||||
   END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
   APPENDIX: How to apply the Apache License to your work.
 | 
			
		||||
 | 
			
		||||
      To apply the Apache License to your work, attach the following
 | 
			
		||||
      boilerplate notice, with the fields enclosed by brackets "[]"
 | 
			
		||||
      replaced with your own identifying information. (Don't include
 | 
			
		||||
      the brackets!)  The text should be enclosed in the appropriate
 | 
			
		||||
      comment syntax for the file format. We also recommend that a
 | 
			
		||||
      file or class name and description of purpose be included on the
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright 2016 Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
   You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
       http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
   Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
   distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/storage licensed under: =
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                 Apache License
 | 
			
		||||
                           Version 2.0, January 2004
 | 
			
		||||
                        http://www.apache.org/licenses/
 | 
			
		||||
 | 
			
		||||
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 | 
			
		||||
 | 
			
		||||
   1. Definitions.
 | 
			
		||||
 | 
			
		||||
      "License" shall mean the terms and conditions for use, reproduction,
 | 
			
		||||
      and distribution as defined by Sections 1 through 9 of this document.
 | 
			
		||||
 | 
			
		||||
      "Licensor" shall mean the copyright owner or entity authorized by
 | 
			
		||||
      the copyright owner that is granting the License.
 | 
			
		||||
 | 
			
		||||
      "Legal Entity" shall mean the union of the acting entity and all
 | 
			
		||||
      other entities that control, are controlled by, or are under common
 | 
			
		||||
      control with that entity. For the purposes of this definition,
 | 
			
		||||
      "control" means (i) the power, direct or indirect, to cause the
 | 
			
		||||
      direction or management of such entity, whether by contract or
 | 
			
		||||
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
 | 
			
		||||
      outstanding shares, or (iii) beneficial ownership of such entity.
 | 
			
		||||
 | 
			
		||||
      "You" (or "Your") shall mean an individual or Legal Entity
 | 
			
		||||
      exercising permissions granted by this License.
 | 
			
		||||
 | 
			
		||||
      "Source" form shall mean the preferred form for making modifications,
 | 
			
		||||
      including but not limited to software source code, documentation
 | 
			
		||||
      source, and configuration files.
 | 
			
		||||
 | 
			
		||||
      "Object" form shall mean any form resulting from mechanical
 | 
			
		||||
      transformation or translation of a Source form, including but
 | 
			
		||||
      not limited to compiled object code, generated documentation,
 | 
			
		||||
      and conversions to other media types.
 | 
			
		||||
 | 
			
		||||
      "Work" shall mean the work of authorship, whether in Source or
 | 
			
		||||
      Object form, made available under the License, as indicated by a
 | 
			
		||||
      copyright notice that is included in or attached to the work
 | 
			
		||||
      (an example is provided in the Appendix below).
 | 
			
		||||
 | 
			
		||||
      "Derivative Works" shall mean any work, whether in Source or Object
 | 
			
		||||
      form, that is based on (or derived from) the Work and for which the
 | 
			
		||||
      editorial revisions, annotations, elaborations, or other modifications
 | 
			
		||||
      represent, as a whole, an original work of authorship. For the purposes
 | 
			
		||||
      of this License, Derivative Works shall not include works that remain
 | 
			
		||||
      separable from, or merely link (or bind by name) to the interfaces of,
 | 
			
		||||
      the Work and Derivative Works thereof.
 | 
			
		||||
 | 
			
		||||
      "Contribution" shall mean any work of authorship, including
 | 
			
		||||
      the original version of the Work and any modifications or additions
 | 
			
		||||
      to that Work or Derivative Works thereof, that is intentionally
 | 
			
		||||
      submitted to Licensor for inclusion in the Work by the copyright owner
 | 
			
		||||
      or by an individual or Legal Entity authorized to submit on behalf of
 | 
			
		||||
      the copyright owner. For the purposes of this definition, "submitted"
 | 
			
		||||
      means any form of electronic, verbal, or written communication sent
 | 
			
		||||
      to the Licensor or its representatives, including but not limited to
 | 
			
		||||
      communication on electronic mailing lists, source code control systems,
 | 
			
		||||
      and issue tracking systems that are managed by, or on behalf of, the
 | 
			
		||||
      Licensor for the purpose of discussing and improving the Work, but
 | 
			
		||||
      excluding communication that is conspicuously marked or otherwise
 | 
			
		||||
      designated in writing by the copyright owner as "Not a Contribution."
 | 
			
		||||
 | 
			
		||||
      "Contributor" shall mean Licensor and any individual or Legal Entity
 | 
			
		||||
      on behalf of whom a Contribution has been received by Licensor and
 | 
			
		||||
      subsequently incorporated within the Work.
 | 
			
		||||
 | 
			
		||||
   2. Grant of Copyright License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      copyright license to reproduce, prepare Derivative Works of,
 | 
			
		||||
      publicly display, publicly perform, sublicense, and distribute the
 | 
			
		||||
      Work and such Derivative Works in Source or Object form.
 | 
			
		||||
 | 
			
		||||
   3. Grant of Patent License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      (except as stated in this section) patent license to make, have made,
 | 
			
		||||
      use, offer to sell, sell, import, and otherwise transfer the Work,
 | 
			
		||||
      where such license applies only to those patent claims licensable
 | 
			
		||||
      by such Contributor that are necessarily infringed by their
 | 
			
		||||
      Contribution(s) alone or by combination of their Contribution(s)
 | 
			
		||||
      with the Work to which such Contribution(s) was submitted. If You
 | 
			
		||||
      institute patent litigation against any entity (including a
 | 
			
		||||
      cross-claim or counterclaim in a lawsuit) alleging that the Work
 | 
			
		||||
      or a Contribution incorporated within the Work constitutes direct
 | 
			
		||||
      or contributory patent infringement, then any patent licenses
 | 
			
		||||
      granted to You under this License for that Work shall terminate
 | 
			
		||||
      as of the date such litigation is filed.
 | 
			
		||||
 | 
			
		||||
   4. Redistribution. You may reproduce and distribute copies of the
 | 
			
		||||
      Work or Derivative Works thereof in any medium, with or without
 | 
			
		||||
      modifications, and in Source or Object form, provided that You
 | 
			
		||||
      meet the following conditions:
 | 
			
		||||
 | 
			
		||||
      (a) You must give any other recipients of the Work or
 | 
			
		||||
          Derivative Works a copy of this License; and
 | 
			
		||||
 | 
			
		||||
      (b) You must cause any modified files to carry prominent notices
 | 
			
		||||
          stating that You changed the files; and
 | 
			
		||||
 | 
			
		||||
      (c) You must retain, in the Source form of any Derivative Works
 | 
			
		||||
          that You distribute, all copyright, patent, trademark, and
 | 
			
		||||
          attribution notices from the Source form of the Work,
 | 
			
		||||
          excluding those notices that do not pertain to any part of
 | 
			
		||||
          the Derivative Works; and
 | 
			
		||||
 | 
			
		||||
      (d) If the Work includes a "NOTICE" text file as part of its
 | 
			
		||||
          distribution, then any Derivative Works that You distribute must
 | 
			
		||||
          include a readable copy of the attribution notices contained
 | 
			
		||||
          within such NOTICE file, excluding those notices that do not
 | 
			
		||||
          pertain to any part of the Derivative Works, in at least one
 | 
			
		||||
          of the following places: within a NOTICE text file distributed
 | 
			
		||||
          as part of the Derivative Works; within the Source form or
 | 
			
		||||
          documentation, if provided along with the Derivative Works; or,
 | 
			
		||||
          within a display generated by the Derivative Works, if and
 | 
			
		||||
          wherever such third-party notices normally appear. The contents
 | 
			
		||||
          of the NOTICE file are for informational purposes only and
 | 
			
		||||
          do not modify the License. You may add Your own attribution
 | 
			
		||||
          notices within Derivative Works that You distribute, alongside
 | 
			
		||||
          or as an addendum to the NOTICE text from the Work, provided
 | 
			
		||||
          that such additional attribution notices cannot be construed
 | 
			
		||||
          as modifying the License.
 | 
			
		||||
 | 
			
		||||
      You may add Your own copyright statement to Your modifications and
 | 
			
		||||
      may provide additional or different license terms and conditions
 | 
			
		||||
      for use, reproduction, or distribution of Your modifications, or
 | 
			
		||||
      for any such Derivative Works as a whole, provided Your use,
 | 
			
		||||
      reproduction, and distribution of the Work otherwise complies with
 | 
			
		||||
      the conditions stated in this License.
 | 
			
		||||
 | 
			
		||||
   5. Submission of Contributions. Unless You explicitly state otherwise,
 | 
			
		||||
      any Contribution intentionally submitted for inclusion in the Work
 | 
			
		||||
      by You to the Licensor shall be under the terms and conditions of
 | 
			
		||||
      this License, without any additional terms or conditions.
 | 
			
		||||
      Notwithstanding the above, nothing herein shall supersede or modify
 | 
			
		||||
      the terms of any separate license agreement you may have executed
 | 
			
		||||
      with Licensor regarding such Contributions.
 | 
			
		||||
 | 
			
		||||
   6. Trademarks. This License does not grant permission to use the trade
 | 
			
		||||
      names, trademarks, service marks, or product names of the Licensor,
 | 
			
		||||
      except as required for reasonable and customary use in describing the
 | 
			
		||||
      origin of the Work and reproducing the content of the NOTICE file.
 | 
			
		||||
 | 
			
		||||
   7. Disclaimer of Warranty. Unless required by applicable law or
 | 
			
		||||
      agreed to in writing, Licensor provides the Work (and each
 | 
			
		||||
      Contributor provides its Contributions) on an "AS IS" BASIS,
 | 
			
		||||
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
      implied, including, without limitation, any warranties or conditions
 | 
			
		||||
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
 | 
			
		||||
      PARTICULAR PURPOSE. You are solely responsible for determining the
 | 
			
		||||
      appropriateness of using or redistributing the Work and assume any
 | 
			
		||||
      risks associated with Your exercise of permissions under this License.
 | 
			
		||||
 | 
			
		||||
   8. Limitation of Liability. In no event and under no legal theory,
 | 
			
		||||
      whether in tort (including negligence), contract, or otherwise,
 | 
			
		||||
      unless required by applicable law (such as deliberate and grossly
 | 
			
		||||
      negligent acts) or agreed to in writing, shall any Contributor be
 | 
			
		||||
      liable to You for damages, including any direct, indirect, special,
 | 
			
		||||
      incidental, or consequential damages of any character arising as a
 | 
			
		||||
      result of this License or out of the use or inability to use the
 | 
			
		||||
      Work (including but not limited to damages for loss of goodwill,
 | 
			
		||||
      work stoppage, computer failure or malfunction, or any and all
 | 
			
		||||
      other commercial damages or losses), even if such Contributor
 | 
			
		||||
      has been advised of the possibility of such damages.
 | 
			
		||||
 | 
			
		||||
   9. Accepting Warranty or Additional Liability. While redistributing
 | 
			
		||||
      the Work or Derivative Works thereof, You may choose to offer,
 | 
			
		||||
      and charge a fee for, acceptance of support, warranty, indemnity,
 | 
			
		||||
      or other liability obligations and/or rights consistent with this
 | 
			
		||||
      License. However, in accepting such obligations, You may act only
 | 
			
		||||
      on Your own behalf and on Your sole responsibility, not on behalf
 | 
			
		||||
      of any other Contributor, and only if You agree to indemnify,
 | 
			
		||||
      defend, and hold each Contributor harmless for any liability
 | 
			
		||||
      incurred by, or claims asserted against, such Contributor by reason
 | 
			
		||||
      of your accepting any such warranty or additional liability.
 | 
			
		||||
 | 
			
		||||
   END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
   APPENDIX: How to apply the Apache License to your work.
 | 
			
		||||
 | 
			
		||||
      To apply the Apache License to your work, attach the following
 | 
			
		||||
      boilerplate notice, with the fields enclosed by brackets "[]"
 | 
			
		||||
      replaced with your own identifying information. (Don't include
 | 
			
		||||
      the brackets!)  The text should be enclosed in the appropriate
 | 
			
		||||
      comment syntax for the file format. We also recommend that a
 | 
			
		||||
      file or class name and description of purpose be included on the
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright 2016 Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
   You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
       http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
   Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
   distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -65515,6 +65935,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/rubiojr/go-vhd/vhd licensed under: =
 | 
			
		||||
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2015 Sergio Rubio
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
= vendor/github.com/rubiojr/go-vhd/LICENSE 9ce5db55ba47444787183e59733e1977  -
 | 
			
		||||
================================================================================
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
================================================================================
 | 
			
		||||
= vendor/github.com/russross/blackfriday licensed under: =
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@ go_library(
 | 
			
		||||
        "//pkg/cloudprovider:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/aws:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/azure:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/gce:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/openstack:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/vsphere:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ import (
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider/providers/azure"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider/providers/gce"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider/providers/openstack"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
 | 
			
		||||
@@ -121,6 +122,8 @@ func ProbeControllerVolumePlugins(cloud cloudprovider.Interface, config componen
 | 
			
		||||
			allPlugins = append(allPlugins, cinder.ProbeVolumePlugins()...)
 | 
			
		||||
		case vsphere.ProviderName == cloud.ProviderName():
 | 
			
		||||
			allPlugins = append(allPlugins, vsphere_volume.ProbeVolumePlugins()...)
 | 
			
		||||
		case azure.CloudProviderName == cloud.ProviderName():
 | 
			
		||||
			allPlugins = append(allPlugins, azure_dd.ProbeVolumePlugins()...)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -149,6 +152,8 @@ func NewAlphaVolumeProvisioner(cloud cloudprovider.Interface, config componentco
 | 
			
		||||
		return getProvisionablePluginFromVolumePlugins(cinder.ProbeVolumePlugins())
 | 
			
		||||
	case cloud != nil && vsphere.ProviderName == cloud.ProviderName():
 | 
			
		||||
		return getProvisionablePluginFromVolumePlugins(vsphere_volume.ProbeVolumePlugins())
 | 
			
		||||
	case cloud != nil && azure.CloudProviderName == cloud.ProviderName():
 | 
			
		||||
		return getProvisionablePluginFromVolumePlugins(azure_dd.ProbeVolumePlugins())
 | 
			
		||||
	}
 | 
			
		||||
	return nil, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -224,6 +224,23 @@ Create a Pod to use the PVC:
 | 
			
		||||
$ kubectl create -f examples/experimental/persistent-volume-provisioning/quobyte/example-pod.yaml
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### Azure Disk
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
kind: StorageClass
 | 
			
		||||
apiVersion: storage.k8s.io/v1beta1
 | 
			
		||||
metadata:
 | 
			
		||||
  name: slow
 | 
			
		||||
provisioner: kubernetes.io/azure-disk
 | 
			
		||||
parameters:
 | 
			
		||||
  skuName: Standard_LRS
 | 
			
		||||
  location: eastus
 | 
			
		||||
  storageAccount: azure_storage_account_name
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
* `skuName`: Azure storage account Sku tier. Default is empty.
 | 
			
		||||
* `location`: Azure storage account location. Default is empty.
 | 
			
		||||
* `storageAccount`: Azure storage account name. If storage account is not provided, all storage accounts associated with the resource group are searched to find one that matches `skuName` and `location`. If storage account is provided, `skuName` and `location` are ignored.
 | 
			
		||||
 | 
			
		||||
### User provisioning requests
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,13 +14,16 @@ go_library(
 | 
			
		||||
    name = "go_default_library",
 | 
			
		||||
    srcs = [
 | 
			
		||||
        "azure.go",
 | 
			
		||||
        "azure_blob.go",
 | 
			
		||||
        "azure_instances.go",
 | 
			
		||||
        "azure_loadbalancer.go",
 | 
			
		||||
        "azure_routes.go",
 | 
			
		||||
        "azure_storage.go",
 | 
			
		||||
        "azure_storageaccount.go",
 | 
			
		||||
        "azure_util.go",
 | 
			
		||||
        "azure_wrap.go",
 | 
			
		||||
        "azure_zones.go",
 | 
			
		||||
        "vhd.go",
 | 
			
		||||
    ],
 | 
			
		||||
    tags = ["automanaged"],
 | 
			
		||||
    deps = [
 | 
			
		||||
@@ -30,11 +33,14 @@ go_library(
 | 
			
		||||
        "//pkg/util/errors:go_default_library",
 | 
			
		||||
        "//vendor:github.com/Azure/azure-sdk-for-go/arm/compute",
 | 
			
		||||
        "//vendor:github.com/Azure/azure-sdk-for-go/arm/network",
 | 
			
		||||
        "//vendor:github.com/Azure/azure-sdk-for-go/arm/storage",
 | 
			
		||||
        "//vendor:github.com/Azure/azure-sdk-for-go/storage",
 | 
			
		||||
        "//vendor:github.com/Azure/go-autorest/autorest",
 | 
			
		||||
        "//vendor:github.com/Azure/go-autorest/autorest/azure",
 | 
			
		||||
        "//vendor:github.com/Azure/go-autorest/autorest/to",
 | 
			
		||||
        "//vendor:github.com/ghodss/yaml",
 | 
			
		||||
        "//vendor:github.com/golang/glog",
 | 
			
		||||
        "//vendor:github.com/rubiojr/go-vhd/vhd",
 | 
			
		||||
    ],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"github.com/Azure/azure-sdk-for-go/arm/compute"
 | 
			
		||||
	"github.com/Azure/azure-sdk-for-go/arm/network"
 | 
			
		||||
	"github.com/Azure/azure-sdk-for-go/arm/storage"
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest/azure"
 | 
			
		||||
	"github.com/ghodss/yaml"
 | 
			
		||||
)
 | 
			
		||||
@@ -61,6 +62,7 @@ type Cloud struct {
 | 
			
		||||
	PublicIPAddressesClient network.PublicIPAddressesClient
 | 
			
		||||
	SecurityGroupsClient    network.SecurityGroupsClient
 | 
			
		||||
	VirtualMachinesClient   compute.VirtualMachinesClient
 | 
			
		||||
	StorageAccountClient    storage.AccountsClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
@@ -135,6 +137,8 @@ func NewCloud(configReader io.Reader) (cloudprovider.Interface, error) {
 | 
			
		||||
	az.SecurityGroupsClient.BaseURI = az.Environment.ResourceManagerEndpoint
 | 
			
		||||
	az.SecurityGroupsClient.Authorizer = servicePrincipalToken
 | 
			
		||||
 | 
			
		||||
	az.StorageAccountClient = storage.NewAccountsClientWithBaseURI(az.Environment.ResourceManagerEndpoint, az.SubscriptionID)
 | 
			
		||||
	az.StorageAccountClient.Authorizer = servicePrincipalToken
 | 
			
		||||
	return &az, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										99
									
								
								pkg/cloudprovider/providers/azure/azure_blob.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								pkg/cloudprovider/providers/azure/azure_blob.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,99 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 The Kubernetes Authors.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"regexp"
 | 
			
		||||
 | 
			
		||||
	azs "github.com/Azure/azure-sdk-for-go/storage"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	vhdContainerName = "vhds"
 | 
			
		||||
	useHTTPS         = true
 | 
			
		||||
	blobServiceName  = "blob"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// create page blob
 | 
			
		||||
func (az *Cloud) createVhdBlob(accountName, accountKey, name string, sizeGB int64, tags map[string]string) (string, string, error) {
 | 
			
		||||
	blobClient, err := az.getBlobClient(accountName, accountKey)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", "", err
 | 
			
		||||
	}
 | 
			
		||||
	size := 1024 * 1024 * 1024 * sizeGB
 | 
			
		||||
	vhdSize := size + vhdHeaderSize /* header size */
 | 
			
		||||
	// Blob name in URL must end with '.vhd' extension.
 | 
			
		||||
	name = name + ".vhd"
 | 
			
		||||
	err = blobClient.PutPageBlob(vhdContainerName, name, vhdSize, tags)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", "", fmt.Errorf("failed to put page blob: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	// add VHD signature to the blob
 | 
			
		||||
	h, err := createVHDHeader(uint64(size))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		az.deleteVhdBlob(accountName, accountKey, name)
 | 
			
		||||
		return "", "", fmt.Errorf("failed to create vhd header, err: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	if err = blobClient.PutPage(vhdContainerName, name, size, vhdSize-1, azs.PageWriteTypeUpdate, h[:vhdHeaderSize], nil); err != nil {
 | 
			
		||||
		az.deleteVhdBlob(accountName, accountKey, name)
 | 
			
		||||
		return "", "", fmt.Errorf("failed to update vhd header, err: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	scheme := "http"
 | 
			
		||||
	if useHTTPS {
 | 
			
		||||
		scheme = "https"
 | 
			
		||||
	}
 | 
			
		||||
	host := fmt.Sprintf("%s://%s.%s.%s", scheme, accountName, blobServiceName, az.Environment.StorageEndpointSuffix)
 | 
			
		||||
	uri := fmt.Sprintf("%s/%s/%s", host, vhdContainerName, name)
 | 
			
		||||
	return name, uri, nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// delete a vhd blob
 | 
			
		||||
func (az *Cloud) deleteVhdBlob(accountName, accountKey, blobName string) error {
 | 
			
		||||
	blobClient, err := az.getBlobClient(accountName, accountKey)
 | 
			
		||||
	if err == nil {
 | 
			
		||||
		return blobClient.DeleteBlob(vhdContainerName, blobName, nil)
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (az *Cloud) getBlobClient(accountName, accountKey string) (*azs.BlobStorageClient, error) {
 | 
			
		||||
	client, err := azs.NewClient(accountName, accountKey, az.Environment.StorageEndpointSuffix, azs.DefaultAPIVersion, useHTTPS)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, fmt.Errorf("error creating azure client: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	b := client.GetBlobService()
 | 
			
		||||
	return &b, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// get uri https://foo.blob.core.windows.net/vhds/bar.vhd and return foo (account) and bar.vhd (blob name)
 | 
			
		||||
func (az *Cloud) getBlobNameAndAccountFromURI(uri string) (string, string, error) {
 | 
			
		||||
	scheme := "http"
 | 
			
		||||
	if useHTTPS {
 | 
			
		||||
		scheme = "https"
 | 
			
		||||
	}
 | 
			
		||||
	host := fmt.Sprintf("%s://(.*).%s.%s", scheme, blobServiceName, az.Environment.StorageEndpointSuffix)
 | 
			
		||||
	reStr := fmt.Sprintf("%s/%s/(.*)", host, vhdContainerName)
 | 
			
		||||
	re := regexp.MustCompile(reStr)
 | 
			
		||||
	res := re.FindSubmatch([]byte(uri))
 | 
			
		||||
	if len(res) < 3 {
 | 
			
		||||
		return "", "", fmt.Errorf("invalid vhd URI for regex %s: %s", reStr, uri)
 | 
			
		||||
	}
 | 
			
		||||
	return string(res[1]), string(res[2]), nil
 | 
			
		||||
}
 | 
			
		||||
@@ -182,3 +182,62 @@ func (az *Cloud) GetNextDiskLun(nodeName types.NodeName) (int32, error) {
 | 
			
		||||
	}
 | 
			
		||||
	return -1, fmt.Errorf("All Luns are used")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateVolume creates a VHD blob in a storage account that has storageType and location using the given storage account.
 | 
			
		||||
// If no storage account is given, search all the storage accounts associated with the resource group and pick one that
 | 
			
		||||
// fits storage type and location.
 | 
			
		||||
func (az *Cloud) CreateVolume(name, storageAccount, storageType, location string, requestGB int) (string, string, int, error) {
 | 
			
		||||
	var err error
 | 
			
		||||
	accounts := []accountWithLocation{}
 | 
			
		||||
	if len(storageAccount) > 0 {
 | 
			
		||||
		accounts = append(accounts, accountWithLocation{Name: storageAccount})
 | 
			
		||||
	} else {
 | 
			
		||||
		// find a storage account
 | 
			
		||||
		accounts, err = az.getStorageAccounts()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			// TODO: create a storage account and container
 | 
			
		||||
			return "", "", 0, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	for _, account := range accounts {
 | 
			
		||||
		glog.V(4).Infof("account %s type %s location %s", account.Name, account.StorageType, account.Location)
 | 
			
		||||
		if ((storageType == "" || account.StorageType == storageType) && (location == "" || account.Location == location)) || len(storageAccount) > 0 {
 | 
			
		||||
			// find the access key with this account
 | 
			
		||||
			key, err := az.getStorageAccesskey(account.Name)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				glog.V(2).Infof("no key found for storage account %s", account.Name)
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// create a page blob in this account's vhd container
 | 
			
		||||
			name, uri, err := az.createVhdBlob(account.Name, key, name, int64(requestGB), nil)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				glog.V(2).Infof("failed to create vhd in account %s: %v", account.Name, err)
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
			glog.V(4).Infof("created vhd blob uri: %s", uri)
 | 
			
		||||
			return name, uri, requestGB, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return "", "", 0, fmt.Errorf("failed to find a matching storage account")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteVolume deletes a VHD blob
 | 
			
		||||
func (az *Cloud) DeleteVolume(name, uri string) error {
 | 
			
		||||
	accountName, blob, err := az.getBlobNameAndAccountFromURI(uri)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("failed to parse vhd URI %v", err)
 | 
			
		||||
	}
 | 
			
		||||
	key, err := az.getStorageAccesskey(accountName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("no key for storage account %s, err %v", accountName, err)
 | 
			
		||||
	}
 | 
			
		||||
	err = az.deleteVhdBlob(accountName, key, blob)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.Warningf("failed to delete blob %s err: %v", uri, err)
 | 
			
		||||
		return fmt.Errorf("failed to delete vhd %v, account %s, blob %s, err: %v", uri, accountName, blob, err)
 | 
			
		||||
	}
 | 
			
		||||
	glog.V(4).Infof("blob %s deleted", uri)
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										77
									
								
								pkg/cloudprovider/providers/azure/azure_storageaccount.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								pkg/cloudprovider/providers/azure/azure_storageaccount.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 The Kubernetes Authors.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type accountWithLocation struct {
 | 
			
		||||
	Name, StorageType, Location string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getStorageAccounts gets the storage accounts' name, type, location in a resource group
 | 
			
		||||
func (az *Cloud) getStorageAccounts() ([]accountWithLocation, error) {
 | 
			
		||||
	result, err := az.StorageAccountClient.ListByResourceGroup(az.ResourceGroup)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if result.Value == nil {
 | 
			
		||||
		return nil, fmt.Errorf("no storage accounts from resource group %s", az.ResourceGroup)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	accounts := []accountWithLocation{}
 | 
			
		||||
	for _, acct := range *result.Value {
 | 
			
		||||
		if acct.Name != nil {
 | 
			
		||||
			name := *acct.Name
 | 
			
		||||
			loc := ""
 | 
			
		||||
			if acct.Location != nil {
 | 
			
		||||
				loc = *acct.Location
 | 
			
		||||
			}
 | 
			
		||||
			storageType := ""
 | 
			
		||||
			if acct.Sku != nil {
 | 
			
		||||
				storageType = string((*acct.Sku).Name)
 | 
			
		||||
			}
 | 
			
		||||
			accounts = append(accounts, accountWithLocation{Name: name, StorageType: storageType, Location: loc})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return accounts, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getStorageAccesskey gets the storage account access key
 | 
			
		||||
func (az *Cloud) getStorageAccesskey(account string) (string, error) {
 | 
			
		||||
	result, err := az.StorageAccountClient.ListKeys(az.ResourceGroup, account)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	if result.Keys == nil {
 | 
			
		||||
		return "", fmt.Errorf("empty keys")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, k := range *result.Keys {
 | 
			
		||||
		if k.Value != nil && *k.Value != "" {
 | 
			
		||||
			v := *k.Value
 | 
			
		||||
			if ind := strings.LastIndex(v, " "); ind >= 0 {
 | 
			
		||||
				v = v[(ind + 1):]
 | 
			
		||||
			}
 | 
			
		||||
			return v, nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return "", fmt.Errorf("no valid keys")
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								pkg/cloudprovider/providers/azure/vhd.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								pkg/cloudprovider/providers/azure/vhd.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 The Kubernetes Authors.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/binary"
 | 
			
		||||
 | 
			
		||||
	"github.com/rubiojr/go-vhd/vhd"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	vhdHeaderSize = vhd.VHD_HEADER_SIZE
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func createVHDHeader(size uint64) ([]byte, error) {
 | 
			
		||||
	h := vhd.CreateFixedHeader(size, &vhd.VHDOptions{})
 | 
			
		||||
	b := new(bytes.Buffer)
 | 
			
		||||
	err := binary.Write(b, binary.BigEndian, h)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return b.Bytes(), nil
 | 
			
		||||
}
 | 
			
		||||
@@ -770,6 +770,8 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string, describerSe
 | 
			
		||||
			printVsphereVolumeSource(pv.Spec.VsphereVolume, out)
 | 
			
		||||
		case pv.Spec.Cinder != nil:
 | 
			
		||||
			printCinderVolumeSource(pv.Spec.Cinder, out)
 | 
			
		||||
		case pv.Spec.AzureDisk != nil:
 | 
			
		||||
			printAzureDiskVolumeSource(pv.Spec.AzureDisk, out)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if events != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -15,11 +15,13 @@ go_library(
 | 
			
		||||
    srcs = [
 | 
			
		||||
        "attacher.go",
 | 
			
		||||
        "azure_dd.go",
 | 
			
		||||
        "azure_provision.go",
 | 
			
		||||
        "vhd_util.go",
 | 
			
		||||
    ],
 | 
			
		||||
    tags = ["automanaged"],
 | 
			
		||||
    deps = [
 | 
			
		||||
        "//pkg/api:go_default_library",
 | 
			
		||||
        "//pkg/api/resource:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider:go_default_library",
 | 
			
		||||
        "//pkg/cloudprovider/providers/azure:go_default_library",
 | 
			
		||||
        "//pkg/types:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,10 @@ type azureCloudProvider interface {
 | 
			
		||||
	GetNextDiskLun(nodeName types.NodeName) (int32, error)
 | 
			
		||||
	// InstanceID returns the cloud provider ID of the specified instance.
 | 
			
		||||
	InstanceID(nodeName types.NodeName) (string, error)
 | 
			
		||||
	// Create a VHD blob
 | 
			
		||||
	CreateVolume(name, storageAccount, storageType, location string, requestGB int) (string, string, int, error)
 | 
			
		||||
	// Delete a VHD blob
 | 
			
		||||
	DeleteVolume(name, uri string) error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ volume.VolumePlugin = &azureDataDiskPlugin{}
 | 
			
		||||
@@ -115,11 +119,20 @@ func (plugin *azureDataDiskPlugin) newMounterInternal(spec *volume.Spec, podUID
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fsType := *azure.FSType
 | 
			
		||||
	fsType := "ext4"
 | 
			
		||||
	if azure.FSType != nil {
 | 
			
		||||
		fsType = *azure.FSType
 | 
			
		||||
	}
 | 
			
		||||
	cachingMode := api.AzureDataDiskCachingNone
 | 
			
		||||
	if azure.CachingMode != nil {
 | 
			
		||||
		cachingMode = *azure.CachingMode
 | 
			
		||||
	}
 | 
			
		||||
	readOnly := false
 | 
			
		||||
	if azure.ReadOnly != nil {
 | 
			
		||||
		readOnly = *azure.ReadOnly
 | 
			
		||||
	}
 | 
			
		||||
	diskName := azure.DiskName
 | 
			
		||||
	diskUri := azure.DataDiskURI
 | 
			
		||||
	cachingMode := *azure.CachingMode
 | 
			
		||||
	return &azureDiskMounter{
 | 
			
		||||
		azureDisk: &azureDisk{
 | 
			
		||||
			podUID:      podUID,
 | 
			
		||||
@@ -131,7 +144,7 @@ func (plugin *azureDataDiskPlugin) newMounterInternal(spec *volume.Spec, podUID
 | 
			
		||||
			plugin:      plugin,
 | 
			
		||||
		},
 | 
			
		||||
		fsType:      fsType,
 | 
			
		||||
		readOnly:    *azure.ReadOnly,
 | 
			
		||||
		readOnly:    readOnly,
 | 
			
		||||
		diskMounter: &mount.SafeFormatAndMount{Interface: plugin.host.GetMounter(), Runner: exec.New()}}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -91,6 +91,14 @@ func (fake *fakeAzureProvider) InstanceID(name string) (string, error) {
 | 
			
		||||
	return "localhost", nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (fake *fakeAzureProvider) CreateVolume(name, storageAccount, storageType, location string, requestGB int) (string, string, int, error) {
 | 
			
		||||
	return "", "", 0, fmt.Errorf("not implemented")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (fake *fakeAzureProvider) DeleteVolume(name, uri string) error {
 | 
			
		||||
	return fmt.Errorf("not implemented")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestPlugin(t *testing.T) {
 | 
			
		||||
	tmpDir, err := utiltesting.MkTmpdir("azure_ddTest")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										162
									
								
								pkg/volume/azure_dd/azure_provision.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										162
									
								
								pkg/volume/azure_dd/azure_provision.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,162 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2016 The Kubernetes Authors.
 | 
			
		||||
 | 
			
		||||
Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
you may not use this file except in compliance with the License.
 | 
			
		||||
You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
    http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
See the License for the specific language governing permissions and
 | 
			
		||||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
package azure_dd
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/api"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/api/resource"
 | 
			
		||||
	utilstrings "k8s.io/kubernetes/pkg/util/strings"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/volume"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var _ volume.DeletableVolumePlugin = &azureDataDiskPlugin{}
 | 
			
		||||
var _ volume.ProvisionableVolumePlugin = &azureDataDiskPlugin{}
 | 
			
		||||
 | 
			
		||||
type azureDiskDeleter struct {
 | 
			
		||||
	*azureDisk
 | 
			
		||||
	azureProvider azureCloudProvider
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (plugin *azureDataDiskPlugin) NewDeleter(spec *volume.Spec) (volume.Deleter, error) {
 | 
			
		||||
	azure, err := getAzureCloudProvider(plugin.host.GetCloudProvider())
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.V(4).Infof("failed to get azure provider")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return plugin.newDeleterInternal(spec, azure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (plugin *azureDataDiskPlugin) newDeleterInternal(spec *volume.Spec, azure azureCloudProvider) (volume.Deleter, error) {
 | 
			
		||||
	if spec.PersistentVolume != nil && spec.PersistentVolume.Spec.AzureDisk == nil {
 | 
			
		||||
		return nil, fmt.Errorf("invalid PV spec")
 | 
			
		||||
	}
 | 
			
		||||
	diskName := spec.PersistentVolume.Spec.AzureDisk.DiskName
 | 
			
		||||
	diskUri := spec.PersistentVolume.Spec.AzureDisk.DataDiskURI
 | 
			
		||||
	return &azureDiskDeleter{
 | 
			
		||||
		azureDisk: &azureDisk{
 | 
			
		||||
			volName:  spec.Name(),
 | 
			
		||||
			diskName: diskName,
 | 
			
		||||
			diskUri:  diskUri,
 | 
			
		||||
			plugin:   plugin,
 | 
			
		||||
		},
 | 
			
		||||
		azureProvider: azure,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (plugin *azureDataDiskPlugin) NewProvisioner(options volume.VolumeOptions) (volume.Provisioner, error) {
 | 
			
		||||
	azure, err := getAzureCloudProvider(plugin.host.GetCloudProvider())
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		glog.V(4).Infof("failed to get azure provider")
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if len(options.PVC.Spec.AccessModes) == 0 {
 | 
			
		||||
		options.PVC.Spec.AccessModes = plugin.GetAccessModes()
 | 
			
		||||
	}
 | 
			
		||||
	return plugin.newProvisionerInternal(options, azure)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (plugin *azureDataDiskPlugin) newProvisionerInternal(options volume.VolumeOptions, azure azureCloudProvider) (volume.Provisioner, error) {
 | 
			
		||||
	return &azureDiskProvisioner{
 | 
			
		||||
		azureDisk: &azureDisk{
 | 
			
		||||
			plugin: plugin,
 | 
			
		||||
		},
 | 
			
		||||
		azureProvider: azure,
 | 
			
		||||
		options:       options,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ volume.Deleter = &azureDiskDeleter{}
 | 
			
		||||
 | 
			
		||||
func (d *azureDiskDeleter) GetPath() string {
 | 
			
		||||
	name := azureDataDiskPluginName
 | 
			
		||||
	return d.plugin.host.GetPodVolumeDir(d.podUID, utilstrings.EscapeQualifiedNameForDisk(name), d.volName)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (d *azureDiskDeleter) Delete() error {
 | 
			
		||||
	glog.V(4).Infof("deleting volume %s", d.diskUri)
 | 
			
		||||
	return d.azureProvider.DeleteVolume(d.diskName, d.diskUri)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type azureDiskProvisioner struct {
 | 
			
		||||
	*azureDisk
 | 
			
		||||
	azureProvider azureCloudProvider
 | 
			
		||||
	options       volume.VolumeOptions
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ volume.Provisioner = &azureDiskProvisioner{}
 | 
			
		||||
 | 
			
		||||
func (a *azureDiskProvisioner) Provision() (*api.PersistentVolume, error) {
 | 
			
		||||
	var sku, location, account string
 | 
			
		||||
 | 
			
		||||
	name := volume.GenerateVolumeName(a.options.ClusterName, a.options.PVName, 255)
 | 
			
		||||
	capacity := a.options.PVC.Spec.Resources.Requests[api.ResourceName(api.ResourceStorage)]
 | 
			
		||||
	requestBytes := capacity.Value()
 | 
			
		||||
	requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
 | 
			
		||||
 | 
			
		||||
	// Apply ProvisionerParameters (case-insensitive). We leave validation of
 | 
			
		||||
	// the values to the cloud provider.
 | 
			
		||||
	for k, v := range a.options.Parameters {
 | 
			
		||||
		switch strings.ToLower(k) {
 | 
			
		||||
		case "skuname":
 | 
			
		||||
			sku = v
 | 
			
		||||
		case "location":
 | 
			
		||||
			location = v
 | 
			
		||||
		case "storageaccount":
 | 
			
		||||
			account = v
 | 
			
		||||
		default:
 | 
			
		||||
			return nil, fmt.Errorf("invalid option %q for volume plugin %s", k, a.plugin.GetPluginName())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// TODO: implement c.options.ProvisionerSelector parsing
 | 
			
		||||
	if a.options.PVC.Spec.Selector != nil {
 | 
			
		||||
		return nil, fmt.Errorf("claim.Spec.Selector is not supported for dynamic provisioning on Azure disk")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	diskName, diskUri, sizeGB, err := a.azureProvider.CreateVolume(name, account, sku, location, requestGB)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pv := &api.PersistentVolume{
 | 
			
		||||
		ObjectMeta: api.ObjectMeta{
 | 
			
		||||
			Name:   a.options.PVName,
 | 
			
		||||
			Labels: map[string]string{},
 | 
			
		||||
			Annotations: map[string]string{
 | 
			
		||||
				"kubernetes.io/createdby": "azure-disk-dynamic-provisioner",
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Spec: api.PersistentVolumeSpec{
 | 
			
		||||
			PersistentVolumeReclaimPolicy: a.options.PersistentVolumeReclaimPolicy,
 | 
			
		||||
			AccessModes:                   a.options.PVC.Spec.AccessModes,
 | 
			
		||||
			Capacity: api.ResourceList{
 | 
			
		||||
				api.ResourceName(api.ResourceStorage): resource.MustParse(fmt.Sprintf("%dGi", sizeGB)),
 | 
			
		||||
			},
 | 
			
		||||
			PersistentVolumeSource: api.PersistentVolumeSource{
 | 
			
		||||
				AzureDisk: &api.AzureDiskVolumeSource{
 | 
			
		||||
					DiskName:    diskName,
 | 
			
		||||
					DataDiskURI: diskUri,
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	return pv, nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/Azure/azure-sdk-for-go/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/Azure/azure-sdk-for-go/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -187,7 +187,7 @@
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright [yyyy] [name of copyright owner]
 | 
			
		||||
   Copyright 2016 Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/availabilitysets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type AvailabilitySetsClient struct {
 | 
			
		||||
// NewAvailabilitySetsClient creates an instance of the AvailabilitySetsClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewAvailabilitySetsClient(subscriptionID string) AvailabilitySetsClient {
 | 
			
		||||
	return AvailabilitySetsClient{New(subscriptionID)}
 | 
			
		||||
	return NewAvailabilitySetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewAvailabilitySetsClientWithBaseURI creates an instance of the
 | 
			
		||||
// AvailabilitySetsClient client.
 | 
			
		||||
func NewAvailabilitySetsClientWithBaseURI(baseURI string, subscriptionID string) AvailabilitySetsClient {
 | 
			
		||||
	return AvailabilitySetsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the operation to create or update the availability set.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -44,9 +44,14 @@ type ManagementClient struct {
 | 
			
		||||
 | 
			
		||||
// New creates an instance of the ManagementClient client.
 | 
			
		||||
func New(subscriptionID string) ManagementClient {
 | 
			
		||||
	return NewWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewWithBaseURI creates an instance of the ManagementClient client.
 | 
			
		||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
 | 
			
		||||
	return ManagementClient{
 | 
			
		||||
		Client:         autorest.NewClientWithUserAgent(UserAgent()),
 | 
			
		||||
		BaseURI:        DefaultBaseURI,
 | 
			
		||||
		BaseURI:        baseURI,
 | 
			
		||||
		APIVersion:     APIVersion,
 | 
			
		||||
		SubscriptionID: subscriptionID,
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/models.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -333,10 +333,10 @@ const (
 | 
			
		||||
	StandardGS5 VirtualMachineSizeTypes = "Standard_GS5"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// AdditionalUnattendContent is gets or sets additional XML formatted
 | 
			
		||||
// information that can be included in the Unattend.xml file, which is used
 | 
			
		||||
// by Windows Setup. Contents are defined by setting name, component name,
 | 
			
		||||
// and the pass in which the content is a applied.
 | 
			
		||||
// AdditionalUnattendContent is additional XML formatted information that can
 | 
			
		||||
// be included in the Unattend.xml file, which is used by Windows Setup.
 | 
			
		||||
// Contents are defined by setting name, component name, and the pass in
 | 
			
		||||
// which the content is a applied.
 | 
			
		||||
type AdditionalUnattendContent struct {
 | 
			
		||||
	PassName      PassNames      `json:"passName,omitempty"`
 | 
			
		||||
	ComponentName ComponentNames `json:"componentName,omitempty"`
 | 
			
		||||
@@ -487,7 +487,7 @@ type LinuxConfiguration struct {
 | 
			
		||||
type ListUsagesResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]Usage `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string  `json:",omitempty"`
 | 
			
		||||
	NextLink          *string  `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListUsagesResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
@@ -910,7 +910,7 @@ type VirtualMachineScaleSetIPConfigurationProperties struct {
 | 
			
		||||
type VirtualMachineScaleSetListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]VirtualMachineScaleSet `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string                   `json:",omitempty"`
 | 
			
		||||
	NextLink          *string                   `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
@@ -930,7 +930,7 @@ func (client VirtualMachineScaleSetListResult) VirtualMachineScaleSetListResultP
 | 
			
		||||
type VirtualMachineScaleSetListSkusResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]VirtualMachineScaleSetSku `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string                      `json:",omitempty"`
 | 
			
		||||
	NextLink          *string                      `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
@@ -1095,7 +1095,7 @@ type VirtualMachineScaleSetVMInstanceView struct {
 | 
			
		||||
type VirtualMachineScaleSetVMListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]VirtualMachineScaleSetVM `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string                     `json:",omitempty"`
 | 
			
		||||
	NextLink          *string                     `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usageoperations.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/usageoperations.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type UsageOperationsClient struct {
 | 
			
		||||
// NewUsageOperationsClient creates an instance of the UsageOperationsClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewUsageOperationsClient(subscriptionID string) UsageOperationsClient {
 | 
			
		||||
	return UsageOperationsClient{New(subscriptionID)}
 | 
			
		||||
	return NewUsageOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewUsageOperationsClientWithBaseURI creates an instance of the
 | 
			
		||||
// UsageOperationsClient client.
 | 
			
		||||
func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string) UsageOperationsClient {
 | 
			
		||||
	return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List lists compute usages for a subscription.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -24,7 +24,7 @@ import (
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	major = "3"
 | 
			
		||||
	minor = "0"
 | 
			
		||||
	minor = "2"
 | 
			
		||||
	patch = "0"
 | 
			
		||||
	// Always begin a "tag" with a dash (as per http://semver.org)
 | 
			
		||||
	tag             = "-beta"
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,13 @@ type VirtualMachineExtensionImagesClient struct {
 | 
			
		||||
// NewVirtualMachineExtensionImagesClient creates an instance of the
 | 
			
		||||
// VirtualMachineExtensionImagesClient client.
 | 
			
		||||
func NewVirtualMachineExtensionImagesClient(subscriptionID string) VirtualMachineExtensionImagesClient {
 | 
			
		||||
	return VirtualMachineExtensionImagesClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineExtensionImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachineExtensionImagesClientWithBaseURI creates an instance of
 | 
			
		||||
// the VirtualMachineExtensionImagesClient client.
 | 
			
		||||
func NewVirtualMachineExtensionImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionImagesClient {
 | 
			
		||||
	return VirtualMachineExtensionImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get gets a virtual machine extension image.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type VirtualMachineExtensionsClient struct {
 | 
			
		||||
// NewVirtualMachineExtensionsClient creates an instance of the
 | 
			
		||||
// VirtualMachineExtensionsClient client.
 | 
			
		||||
func NewVirtualMachineExtensionsClient(subscriptionID string) VirtualMachineExtensionsClient {
 | 
			
		||||
	return VirtualMachineExtensionsClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachineExtensionsClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachineExtensionsClient client.
 | 
			
		||||
func NewVirtualMachineExtensionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineExtensionsClient {
 | 
			
		||||
	return VirtualMachineExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the operation to create or update the extension. This method
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineimages.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type VirtualMachineImagesClient struct {
 | 
			
		||||
// NewVirtualMachineImagesClient creates an instance of the
 | 
			
		||||
// VirtualMachineImagesClient client.
 | 
			
		||||
func NewVirtualMachineImagesClient(subscriptionID string) VirtualMachineImagesClient {
 | 
			
		||||
	return VirtualMachineImagesClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineImagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachineImagesClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachineImagesClient client.
 | 
			
		||||
func NewVirtualMachineImagesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImagesClient {
 | 
			
		||||
	return VirtualMachineImagesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get gets a virtual machine image.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachines.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type VirtualMachinesClient struct {
 | 
			
		||||
// NewVirtualMachinesClient creates an instance of the VirtualMachinesClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewVirtualMachinesClient(subscriptionID string) VirtualMachinesClient {
 | 
			
		||||
	return VirtualMachinesClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachinesClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachinesClient client.
 | 
			
		||||
func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachinesClient {
 | 
			
		||||
	return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Capture captures the VM by copying virtual hard disks of the VM and outputs
 | 
			
		||||
@@ -501,6 +507,30 @@ func (client VirtualMachinesClient) ListResponder(resp *http.Response) (result V
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListNextResults retrieves the next set of results, if any.
 | 
			
		||||
func (client VirtualMachinesClient) ListNextResults(lastResults VirtualMachineListResult) (result VirtualMachineListResult, err error) {
 | 
			
		||||
	req, err := lastResults.VirtualMachineListResultPreparer()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", nil, "Failure preparing next results request request")
 | 
			
		||||
	}
 | 
			
		||||
	if req == nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure sending next results request request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "List", resp, "Failure responding to next results request request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll gets the list of Virtual Machines in the subscription. Use nextLink
 | 
			
		||||
// property in the response to get the next page of Virtual Machines. Do this
 | 
			
		||||
// till nextLink is not null to fetch all the Virtual Machines.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type VirtualMachineScaleSetsClient struct {
 | 
			
		||||
// NewVirtualMachineScaleSetsClient creates an instance of the
 | 
			
		||||
// VirtualMachineScaleSetsClient client.
 | 
			
		||||
func NewVirtualMachineScaleSetsClient(subscriptionID string) VirtualMachineScaleSetsClient {
 | 
			
		||||
	return VirtualMachineScaleSetsClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineScaleSetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachineScaleSetsClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachineScaleSetsClient client.
 | 
			
		||||
func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetsClient {
 | 
			
		||||
	return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate allows you to create or update a virtual machine scale set
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,15 +32,21 @@ type VirtualMachineScaleSetVMsClient struct {
 | 
			
		||||
// NewVirtualMachineScaleSetVMsClient creates an instance of the
 | 
			
		||||
// VirtualMachineScaleSetVMsClient client.
 | 
			
		||||
func NewVirtualMachineScaleSetVMsClient(subscriptionID string) VirtualMachineScaleSetVMsClient {
 | 
			
		||||
	return VirtualMachineScaleSetVMsClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineScaleSetVMsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Deallocate allows you to deallocate a virtual machine virtual machine scale
 | 
			
		||||
// set.Shuts down the virtual machine and releases the compute resources. You
 | 
			
		||||
// are not billed for the compute resources that this virtual machine uses.
 | 
			
		||||
// This method may poll for completion. Polling can be canceled by passing
 | 
			
		||||
// the cancel channel argument. The channel will be used to cancel polling
 | 
			
		||||
// and any outstanding HTTP requests.
 | 
			
		||||
// NewVirtualMachineScaleSetVMsClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachineScaleSetVMsClient client.
 | 
			
		||||
func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineScaleSetVMsClient {
 | 
			
		||||
	return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Deallocate allows you to deallocate a virtual machine scale set virtual
 | 
			
		||||
// machine. Shuts down the virtual machine and releases the compute
 | 
			
		||||
// resources. You are not billed for the compute resources that this virtual
 | 
			
		||||
// machine uses. This method may poll for completion. Polling can be canceled
 | 
			
		||||
// by passing the cancel channel argument. The channel will be used to cancel
 | 
			
		||||
// polling and any outstanding HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
 | 
			
		||||
// name of the virtual machine scale set. instanceID is the instance id of
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,7 +32,13 @@ type VirtualMachineSizesClient struct {
 | 
			
		||||
// NewVirtualMachineSizesClient creates an instance of the
 | 
			
		||||
// VirtualMachineSizesClient client.
 | 
			
		||||
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
 | 
			
		||||
	return VirtualMachineSizesClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualMachineSizesClient client.
 | 
			
		||||
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
 | 
			
		||||
	return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List lists all available virtual machine sizes for a subscription in a
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/applicationgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type ApplicationGatewaysClient struct {
 | 
			
		||||
// NewApplicationGatewaysClient creates an instance of the
 | 
			
		||||
// ApplicationGatewaysClient client.
 | 
			
		||||
func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient {
 | 
			
		||||
	return ApplicationGatewaysClient{New(subscriptionID)}
 | 
			
		||||
	return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewApplicationGatewaysClientWithBaseURI creates an instance of the
 | 
			
		||||
// ApplicationGatewaysClient client.
 | 
			
		||||
func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient {
 | 
			
		||||
	return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put ApplicationGateway operation creates/updates a
 | 
			
		||||
@@ -240,7 +246,7 @@ func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (resul
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List ApplicationGateway opertion retrieves all the
 | 
			
		||||
// List the List ApplicationGateway operation retrieves all the
 | 
			
		||||
// applicationgateways in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
@@ -326,7 +332,7 @@ func (client ApplicationGatewaysClient) ListNextResults(lastResults ApplicationG
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll the List applicationgateway opertion retrieves all the
 | 
			
		||||
// ListAll the List applicationgateway operation retrieves all the
 | 
			
		||||
// applicationgateways in a subscription.
 | 
			
		||||
func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayListResult, err error) {
 | 
			
		||||
	req, err := client.ListAllPreparer()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
// Package network implements the Azure ARM Network service API version
 | 
			
		||||
// 2016-03-30.
 | 
			
		||||
// 2016-06-01.
 | 
			
		||||
//
 | 
			
		||||
// The Microsoft Azure Network management API provides a RESTful set of web
 | 
			
		||||
// services that interact with Microsoft Azure Networks service to manage
 | 
			
		||||
@@ -33,7 +33,7 @@ import (
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// APIVersion is the version of the Network
 | 
			
		||||
	APIVersion = "2016-03-30"
 | 
			
		||||
	APIVersion = "2016-06-01"
 | 
			
		||||
 | 
			
		||||
	// DefaultBaseURI is the default URI used for the service Network
 | 
			
		||||
	DefaultBaseURI = "https://management.azure.com"
 | 
			
		||||
@@ -49,9 +49,14 @@ type ManagementClient struct {
 | 
			
		||||
 | 
			
		||||
// New creates an instance of the ManagementClient client.
 | 
			
		||||
func New(subscriptionID string) ManagementClient {
 | 
			
		||||
	return NewWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewWithBaseURI creates an instance of the ManagementClient client.
 | 
			
		||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
 | 
			
		||||
	return ManagementClient{
 | 
			
		||||
		Client:         autorest.NewClientWithUserAgent(UserAgent()),
 | 
			
		||||
		BaseURI:        DefaultBaseURI,
 | 
			
		||||
		BaseURI:        baseURI,
 | 
			
		||||
		APIVersion:     APIVersion,
 | 
			
		||||
		SubscriptionID: subscriptionID,
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,13 @@ type ExpressRouteCircuitAuthorizationsClient struct {
 | 
			
		||||
// NewExpressRouteCircuitAuthorizationsClient creates an instance of the
 | 
			
		||||
// ExpressRouteCircuitAuthorizationsClient client.
 | 
			
		||||
func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
 | 
			
		||||
	return ExpressRouteCircuitAuthorizationsClient{New(subscriptionID)}
 | 
			
		||||
	return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance
 | 
			
		||||
// of the ExpressRouteCircuitAuthorizationsClient client.
 | 
			
		||||
func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient {
 | 
			
		||||
	return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put Authorization operation creates/updates an
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type ExpressRouteCircuitPeeringsClient struct {
 | 
			
		||||
// NewExpressRouteCircuitPeeringsClient creates an instance of the
 | 
			
		||||
// ExpressRouteCircuitPeeringsClient client.
 | 
			
		||||
func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient {
 | 
			
		||||
	return ExpressRouteCircuitPeeringsClient{New(subscriptionID)}
 | 
			
		||||
	return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the
 | 
			
		||||
// ExpressRouteCircuitPeeringsClient client.
 | 
			
		||||
func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient {
 | 
			
		||||
	return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put Pering operation creates/updates an peering in the
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuits.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type ExpressRouteCircuitsClient struct {
 | 
			
		||||
// NewExpressRouteCircuitsClient creates an instance of the
 | 
			
		||||
// ExpressRouteCircuitsClient client.
 | 
			
		||||
func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient {
 | 
			
		||||
	return ExpressRouteCircuitsClient{New(subscriptionID)}
 | 
			
		||||
	return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the
 | 
			
		||||
// ExpressRouteCircuitsClient client.
 | 
			
		||||
func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient {
 | 
			
		||||
	return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put ExpressRouteCircuit operation creates/updates a
 | 
			
		||||
@@ -240,7 +246,7 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPeeringStats the Liststats ExpressRouteCircuit opertion retrieves all
 | 
			
		||||
// GetPeeringStats the Liststats ExpressRouteCircuit operation retrieves all
 | 
			
		||||
// the stats from a ExpressRouteCircuits in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. circuitName is the
 | 
			
		||||
@@ -305,8 +311,8 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Res
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetStats the Liststats ExpressRouteCircuit opertion retrieves all the stats
 | 
			
		||||
// from a ExpressRouteCircuits in a resource group.
 | 
			
		||||
// GetStats the Liststats ExpressRouteCircuit operation retrieves all the
 | 
			
		||||
// stats from a ExpressRouteCircuits in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. circuitName is the
 | 
			
		||||
// name of the circuit.
 | 
			
		||||
@@ -369,7 +375,7 @@ func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List ExpressRouteCircuit opertion retrieves all the
 | 
			
		||||
// List the List ExpressRouteCircuit operation retrieves all the
 | 
			
		||||
// ExpressRouteCircuits in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
@@ -455,7 +461,7 @@ func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRout
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll the List ExpressRouteCircuit opertion retrieves all the
 | 
			
		||||
// ListAll the List ExpressRouteCircuit operation retrieves all the
 | 
			
		||||
// ExpressRouteCircuits in a subscription.
 | 
			
		||||
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) {
 | 
			
		||||
	req, err := client.ListAllPreparer()
 | 
			
		||||
@@ -538,7 +544,7 @@ func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressR
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListArpTable the ListArpTable from ExpressRouteCircuit opertion retrieves
 | 
			
		||||
// ListArpTable the ListArpTable from ExpressRouteCircuit operation retrieves
 | 
			
		||||
// the currently advertised arp table associated with the
 | 
			
		||||
// ExpressRouteCircuits in a resource group. This method may poll for
 | 
			
		||||
// completion. Polling can be canceled by passing the cancel channel
 | 
			
		||||
@@ -610,7 +616,7 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListRoutesTable the ListRoutesTable from ExpressRouteCircuit opertion
 | 
			
		||||
// ListRoutesTable the ListRoutesTable from ExpressRouteCircuit operation
 | 
			
		||||
// retrieves the currently advertised routes table associated with the
 | 
			
		||||
// ExpressRouteCircuits in a resource group. This method may poll for
 | 
			
		||||
// completion. Polling can be canceled by passing the cancel channel
 | 
			
		||||
@@ -683,7 +689,7 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListRoutesTableSummary the ListRoutesTable from ExpressRouteCircuit
 | 
			
		||||
// opertion retrieves the currently advertised routes table associated with
 | 
			
		||||
// operation retrieves the currently advertised routes table associated with
 | 
			
		||||
// the ExpressRouteCircuits in a resource group. This method may poll for
 | 
			
		||||
// completion. Polling can be canceled by passing the cancel channel
 | 
			
		||||
// argument. The channel will be used to cancel polling and any outstanding
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,10 +36,16 @@ type ExpressRouteServiceProvidersClient struct {
 | 
			
		||||
// NewExpressRouteServiceProvidersClient creates an instance of the
 | 
			
		||||
// ExpressRouteServiceProvidersClient client.
 | 
			
		||||
func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient {
 | 
			
		||||
	return ExpressRouteServiceProvidersClient{New(subscriptionID)}
 | 
			
		||||
	return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List ExpressRouteServiceProvider opertion retrieves all the
 | 
			
		||||
// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the
 | 
			
		||||
// ExpressRouteServiceProvidersClient client.
 | 
			
		||||
func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient {
 | 
			
		||||
	return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List ExpressRouteServiceProvider operation retrieves all the
 | 
			
		||||
// available ExpressRouteServiceProviders.
 | 
			
		||||
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) {
 | 
			
		||||
	req, err := client.ListPreparer()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										148
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										148
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/interfaces.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -35,7 +35,13 @@ type InterfacesClient struct {
 | 
			
		||||
 | 
			
		||||
// NewInterfacesClient creates an instance of the InterfacesClient client.
 | 
			
		||||
func NewInterfacesClient(subscriptionID string) InterfacesClient {
 | 
			
		||||
	return InterfacesClient{New(subscriptionID)}
 | 
			
		||||
	return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient {
 | 
			
		||||
	return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put NetworkInterface operation creates/updates a
 | 
			
		||||
@@ -243,6 +249,74 @@ func (client InterfacesClient) GetResponder(resp *http.Response) (result Interfa
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetEffectiveRouteTable the get effective routetable operation retrieves all
 | 
			
		||||
// the route tables applied on a networkInterface. This method may poll for
 | 
			
		||||
// completion. Polling can be canceled by passing the cancel channel
 | 
			
		||||
// argument. The channel will be used to cancel polling and any outstanding
 | 
			
		||||
// HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. networkInterfaceName
 | 
			
		||||
// is the name of the network interface.
 | 
			
		||||
func (client InterfacesClient) GetEffectiveRouteTable(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.GetEffectiveRouteTablePreparer(resourceGroupName, networkInterfaceName, cancel)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.GetEffectiveRouteTableSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.GetEffectiveRouteTableResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request.
 | 
			
		||||
func (client InterfacesClient) GetEffectiveRouteTablePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
 | 
			
		||||
		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{Cancel: cancel})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client,
 | 
			
		||||
		req,
 | 
			
		||||
		azure.DoPollForAsynchronous(client.PollingDelay))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetVirtualMachineScaleSetNetworkInterface the Get ntework interface
 | 
			
		||||
// operation retreives information about the specified network interface in a
 | 
			
		||||
// virtual machine scale set.
 | 
			
		||||
@@ -315,7 +389,7 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponde
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List networkInterfaces opertion retrieves all the
 | 
			
		||||
// List the List networkInterfaces operation retrieves all the
 | 
			
		||||
// networkInterfaces in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
@@ -401,7 +475,7 @@ func (client InterfacesClient) ListNextResults(lastResults InterfaceListResult)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll the List networkInterfaces opertion retrieves all the
 | 
			
		||||
// ListAll the List networkInterfaces operation retrieves all the
 | 
			
		||||
// networkInterfaces in a subscription.
 | 
			
		||||
func (client InterfacesClient) ListAll() (result InterfaceListResult, err error) {
 | 
			
		||||
	req, err := client.ListAllPreparer()
 | 
			
		||||
@@ -484,6 +558,74 @@ func (client InterfacesClient) ListAllNextResults(lastResults InterfaceListResul
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListEffectiveNetworkSecurityGroups the list effective network security
 | 
			
		||||
// group operation retrieves all the network security groups applied on a
 | 
			
		||||
// networkInterface. This method may poll for completion. Polling can be
 | 
			
		||||
// canceled by passing the cancel channel argument. The channel will be used
 | 
			
		||||
// to cancel polling and any outstanding HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. networkInterfaceName
 | 
			
		||||
// is the name of the network interface.
 | 
			
		||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName, networkInterfaceName, cancel)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListEffectiveNetworkSecurityGroupsSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListEffectiveNetworkSecurityGroupsResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request.
 | 
			
		||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
 | 
			
		||||
		"resourceGroupName":    autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":       autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{Cancel: cancel})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client,
 | 
			
		||||
		req,
 | 
			
		||||
		azure.DoPollForAsynchronous(client.PollingDelay))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListVirtualMachineScaleSetNetworkInterfaces the list network interface
 | 
			
		||||
// operation retrieves information about all network interfaces in a virtual
 | 
			
		||||
// machine scale set.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/loadbalancers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type LoadBalancersClient struct {
 | 
			
		||||
// NewLoadBalancersClient creates an instance of the LoadBalancersClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewLoadBalancersClient(subscriptionID string) LoadBalancersClient {
 | 
			
		||||
	return LoadBalancersClient{New(subscriptionID)}
 | 
			
		||||
	return NewLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewLoadBalancersClientWithBaseURI creates an instance of the
 | 
			
		||||
// LoadBalancersClient client.
 | 
			
		||||
func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancersClient {
 | 
			
		||||
	return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put LoadBalancer operation creates/updates a
 | 
			
		||||
@@ -243,7 +249,7 @@ func (client LoadBalancersClient) GetResponder(resp *http.Response) (result Load
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List loadBalancer opertion retrieves all the loadbalancers in a
 | 
			
		||||
// List the List loadBalancer operation retrieves all the loadbalancers in a
 | 
			
		||||
// resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
@@ -329,8 +335,8 @@ func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListRe
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll the List loadBalancer opertion retrieves all the loadbalancers in a
 | 
			
		||||
// subscription.
 | 
			
		||||
// ListAll the List loadBalancer operation retrieves all the loadbalancers in
 | 
			
		||||
// a subscription.
 | 
			
		||||
func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) {
 | 
			
		||||
	req, err := client.ListAllPreparer()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/localnetworkgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type LocalNetworkGatewaysClient struct {
 | 
			
		||||
// NewLocalNetworkGatewaysClient creates an instance of the
 | 
			
		||||
// LocalNetworkGatewaysClient client.
 | 
			
		||||
func NewLocalNetworkGatewaysClient(subscriptionID string) LocalNetworkGatewaysClient {
 | 
			
		||||
	return LocalNetworkGatewaysClient{New(subscriptionID)}
 | 
			
		||||
	return NewLocalNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewLocalNetworkGatewaysClientWithBaseURI creates an instance of the
 | 
			
		||||
// LocalNetworkGatewaysClient client.
 | 
			
		||||
func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) LocalNetworkGatewaysClient {
 | 
			
		||||
	return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put LocalNetworkGateway operation creates/updates a
 | 
			
		||||
@@ -243,8 +249,8 @@ func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (resu
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List LocalNetworkGateways opertion retrieves all the local network
 | 
			
		||||
// gateways stored.
 | 
			
		||||
// List the List LocalNetworkGateways operation retrieves all the local
 | 
			
		||||
// network gateways stored.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										278
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										278
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/models.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -96,6 +96,22 @@ const (
 | 
			
		||||
	StandardSmall ApplicationGatewaySkuName = "Standard_Small"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewaySslProtocol enumerates the values for application gateway
 | 
			
		||||
// ssl protocol.
 | 
			
		||||
type ApplicationGatewaySslProtocol string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// TLSv10 specifies the tl sv 10 state for application gateway ssl
 | 
			
		||||
	// protocol.
 | 
			
		||||
	TLSv10 ApplicationGatewaySslProtocol = "TLSv1_0"
 | 
			
		||||
	// TLSv11 specifies the tl sv 11 state for application gateway ssl
 | 
			
		||||
	// protocol.
 | 
			
		||||
	TLSv11 ApplicationGatewaySslProtocol = "TLSv1_1"
 | 
			
		||||
	// TLSv12 specifies the tl sv 12 state for application gateway ssl
 | 
			
		||||
	// protocol.
 | 
			
		||||
	TLSv12 ApplicationGatewaySslProtocol = "TLSv1_2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayTier enumerates the values for application gateway tier.
 | 
			
		||||
type ApplicationGatewayTier string
 | 
			
		||||
 | 
			
		||||
@@ -114,6 +130,34 @@ const (
 | 
			
		||||
	InUse AuthorizationUseStatus = "InUse"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EffectiveRouteSource enumerates the values for effective route source.
 | 
			
		||||
type EffectiveRouteSource string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// EffectiveRouteSourceDefault specifies the effective route source
 | 
			
		||||
	// default state for effective route source.
 | 
			
		||||
	EffectiveRouteSourceDefault EffectiveRouteSource = "Default"
 | 
			
		||||
	// EffectiveRouteSourceUnknown specifies the effective route source
 | 
			
		||||
	// unknown state for effective route source.
 | 
			
		||||
	EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown"
 | 
			
		||||
	// EffectiveRouteSourceUser specifies the effective route source user
 | 
			
		||||
	// state for effective route source.
 | 
			
		||||
	EffectiveRouteSourceUser EffectiveRouteSource = "User"
 | 
			
		||||
	// EffectiveRouteSourceVirtualNetworkGateway specifies the effective route
 | 
			
		||||
	// source virtual network gateway state for effective route source.
 | 
			
		||||
	EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EffectiveRouteState enumerates the values for effective route state.
 | 
			
		||||
type EffectiveRouteState string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Active specifies the active state for effective route state.
 | 
			
		||||
	Active EffectiveRouteState = "Active"
 | 
			
		||||
	// Invalid specifies the invalid state for effective route state.
 | 
			
		||||
	Invalid EffectiveRouteState = "Invalid"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values
 | 
			
		||||
// for express route circuit peering advertised public prefix state.
 | 
			
		||||
type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string
 | 
			
		||||
@@ -426,6 +470,22 @@ const (
 | 
			
		||||
	VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeeringState enumerates the values for virtual network
 | 
			
		||||
// peering state.
 | 
			
		||||
type VirtualNetworkPeeringState string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// VirtualNetworkPeeringStateConnected specifies the virtual network
 | 
			
		||||
	// peering state connected state for virtual network peering state.
 | 
			
		||||
	VirtualNetworkPeeringStateConnected VirtualNetworkPeeringState = "Connected"
 | 
			
		||||
	// VirtualNetworkPeeringStateDisconnected specifies the virtual network
 | 
			
		||||
	// peering state disconnected state for virtual network peering state.
 | 
			
		||||
	VirtualNetworkPeeringStateDisconnected VirtualNetworkPeeringState = "Disconnected"
 | 
			
		||||
	// VirtualNetworkPeeringStateInitiated specifies the virtual network
 | 
			
		||||
	// peering state initiated state for virtual network peering state.
 | 
			
		||||
	VirtualNetworkPeeringStateInitiated VirtualNetworkPeeringState = "Initiated"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// VpnType enumerates the values for vpn type.
 | 
			
		||||
type VpnType string
 | 
			
		||||
 | 
			
		||||
@@ -454,6 +514,22 @@ type ApplicationGateway struct {
 | 
			
		||||
	Etag              *string                             `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayAuthenticationCertificate is authentication certificates
 | 
			
		||||
// of application gateway
 | 
			
		||||
type ApplicationGatewayAuthenticationCertificate struct {
 | 
			
		||||
	ID         *string                                                      `json:"id,omitempty"`
 | 
			
		||||
	Properties *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"`
 | 
			
		||||
	Name       *string                                                      `json:"name,omitempty"`
 | 
			
		||||
	Etag       *string                                                      `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayAuthenticationCertificatePropertiesFormat is properties
 | 
			
		||||
// of Authentication certificates of application gateway
 | 
			
		||||
type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct {
 | 
			
		||||
	Data              *string `json:"data,omitempty"`
 | 
			
		||||
	ProvisioningState *string `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayBackendAddress is backend Address of application gateway
 | 
			
		||||
type ApplicationGatewayBackendAddress struct {
 | 
			
		||||
	Fqdn      *string `json:"fqdn,omitempty"`
 | 
			
		||||
@@ -489,12 +565,13 @@ type ApplicationGatewayBackendHTTPSettings struct {
 | 
			
		||||
// ApplicationGatewayBackendHTTPSettingsPropertiesFormat is properties of
 | 
			
		||||
// Backend address pool settings of application gateway
 | 
			
		||||
type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct {
 | 
			
		||||
	Port                *int32                                `json:"port,omitempty"`
 | 
			
		||||
	Protocol            ApplicationGatewayProtocol            `json:"protocol,omitempty"`
 | 
			
		||||
	CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"`
 | 
			
		||||
	RequestTimeout      *int32                                `json:"requestTimeout,omitempty"`
 | 
			
		||||
	Probe               *SubResource                          `json:"probe,omitempty"`
 | 
			
		||||
	ProvisioningState   *string                               `json:"provisioningState,omitempty"`
 | 
			
		||||
	Port                       *int32                                `json:"port,omitempty"`
 | 
			
		||||
	Protocol                   ApplicationGatewayProtocol            `json:"protocol,omitempty"`
 | 
			
		||||
	CookieBasedAffinity        ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"`
 | 
			
		||||
	RequestTimeout             *int32                                `json:"requestTimeout,omitempty"`
 | 
			
		||||
	Probe                      *SubResource                          `json:"probe,omitempty"`
 | 
			
		||||
	AuthenticationCertificates *[]SubResource                        `json:"authenticationCertificates,omitempty"`
 | 
			
		||||
	ProvisioningState          *string                               `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayFrontendIPConfiguration is frontend IP configuration of
 | 
			
		||||
@@ -566,8 +643,8 @@ type ApplicationGatewayIPConfigurationPropertiesFormat struct {
 | 
			
		||||
	ProvisioningState *string      `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayListResult is response for ListLoadBalancers Api service
 | 
			
		||||
// call
 | 
			
		||||
// ApplicationGatewayListResult is response for ListApplicationGateways Api
 | 
			
		||||
// service call
 | 
			
		||||
type ApplicationGatewayListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]ApplicationGateway `json:"value,omitempty"`
 | 
			
		||||
@@ -626,20 +703,22 @@ type ApplicationGatewayProbePropertiesFormat struct {
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayPropertiesFormat is properties of Application Gateway
 | 
			
		||||
type ApplicationGatewayPropertiesFormat struct {
 | 
			
		||||
	Sku                           *ApplicationGatewaySku                       `json:"sku,omitempty"`
 | 
			
		||||
	OperationalState              ApplicationGatewayOperationalState           `json:"operationalState,omitempty"`
 | 
			
		||||
	GatewayIPConfigurations       *[]ApplicationGatewayIPConfiguration         `json:"gatewayIPConfigurations,omitempty"`
 | 
			
		||||
	SslCertificates               *[]ApplicationGatewaySslCertificate          `json:"sslCertificates,omitempty"`
 | 
			
		||||
	FrontendIPConfigurations      *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"`
 | 
			
		||||
	FrontendPorts                 *[]ApplicationGatewayFrontendPort            `json:"frontendPorts,omitempty"`
 | 
			
		||||
	Probes                        *[]ApplicationGatewayProbe                   `json:"probes,omitempty"`
 | 
			
		||||
	BackendAddressPools           *[]ApplicationGatewayBackendAddressPool      `json:"backendAddressPools,omitempty"`
 | 
			
		||||
	BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings     `json:"backendHttpSettingsCollection,omitempty"`
 | 
			
		||||
	HTTPListeners                 *[]ApplicationGatewayHTTPListener            `json:"httpListeners,omitempty"`
 | 
			
		||||
	URLPathMaps                   *[]ApplicationGatewayURLPathMap              `json:"urlPathMaps,omitempty"`
 | 
			
		||||
	RequestRoutingRules           *[]ApplicationGatewayRequestRoutingRule      `json:"requestRoutingRules,omitempty"`
 | 
			
		||||
	ResourceGUID                  *string                                      `json:"resourceGuid,omitempty"`
 | 
			
		||||
	ProvisioningState             *string                                      `json:"provisioningState,omitempty"`
 | 
			
		||||
	Sku                           *ApplicationGatewaySku                         `json:"sku,omitempty"`
 | 
			
		||||
	SslPolicy                     *ApplicationGatewaySslPolicy                   `json:"sslPolicy,omitempty"`
 | 
			
		||||
	OperationalState              ApplicationGatewayOperationalState             `json:"operationalState,omitempty"`
 | 
			
		||||
	GatewayIPConfigurations       *[]ApplicationGatewayIPConfiguration           `json:"gatewayIPConfigurations,omitempty"`
 | 
			
		||||
	AuthenticationCertificates    *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"`
 | 
			
		||||
	SslCertificates               *[]ApplicationGatewaySslCertificate            `json:"sslCertificates,omitempty"`
 | 
			
		||||
	FrontendIPConfigurations      *[]ApplicationGatewayFrontendIPConfiguration   `json:"frontendIPConfigurations,omitempty"`
 | 
			
		||||
	FrontendPorts                 *[]ApplicationGatewayFrontendPort              `json:"frontendPorts,omitempty"`
 | 
			
		||||
	Probes                        *[]ApplicationGatewayProbe                     `json:"probes,omitempty"`
 | 
			
		||||
	BackendAddressPools           *[]ApplicationGatewayBackendAddressPool        `json:"backendAddressPools,omitempty"`
 | 
			
		||||
	BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings       `json:"backendHttpSettingsCollection,omitempty"`
 | 
			
		||||
	HTTPListeners                 *[]ApplicationGatewayHTTPListener              `json:"httpListeners,omitempty"`
 | 
			
		||||
	URLPathMaps                   *[]ApplicationGatewayURLPathMap                `json:"urlPathMaps,omitempty"`
 | 
			
		||||
	RequestRoutingRules           *[]ApplicationGatewayRequestRoutingRule        `json:"requestRoutingRules,omitempty"`
 | 
			
		||||
	ResourceGUID                  *string                                        `json:"resourceGuid,omitempty"`
 | 
			
		||||
	ProvisioningState             *string                                        `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayRequestRoutingRule is request routing rule of application
 | 
			
		||||
@@ -686,6 +765,11 @@ type ApplicationGatewaySslCertificatePropertiesFormat struct {
 | 
			
		||||
	ProvisioningState *string `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewaySslPolicy is application gateway SSL policy
 | 
			
		||||
type ApplicationGatewaySslPolicy struct {
 | 
			
		||||
	DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayURLPathMap is urlPathMap of application gateway
 | 
			
		||||
type ApplicationGatewayURLPathMap struct {
 | 
			
		||||
	ID         *string                                       `json:"id,omitempty"`
 | 
			
		||||
@@ -694,7 +778,7 @@ type ApplicationGatewayURLPathMap struct {
 | 
			
		||||
	Etag       *string                                       `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ApplicationGatewayURLPathMapPropertiesFormat is properties of probe of
 | 
			
		||||
// ApplicationGatewayURLPathMapPropertiesFormat is properties of UrlPathMap of
 | 
			
		||||
// application gateway
 | 
			
		||||
type ApplicationGatewayURLPathMapPropertiesFormat struct {
 | 
			
		||||
	DefaultBackendAddressPool  *SubResource                  `json:"defaultBackendAddressPool,omitempty"`
 | 
			
		||||
@@ -799,6 +883,61 @@ type DNSNameAvailabilityResult struct {
 | 
			
		||||
	Available         *bool `json:"available,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveNetworkSecurityGroup is effective NetworkSecurityGroup
 | 
			
		||||
type EffectiveNetworkSecurityGroup struct {
 | 
			
		||||
	NetworkSecurityGroup   *SubResource                              `json:"networkSecurityGroup,omitempty"`
 | 
			
		||||
	Association            *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"`
 | 
			
		||||
	EffectiveSecurityRules *[]EffectiveNetworkSecurityRule           `json:"effectiveSecurityRules,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveNetworkSecurityGroupAssociation is effective NetworkSecurityGroup
 | 
			
		||||
// association
 | 
			
		||||
type EffectiveNetworkSecurityGroupAssociation struct {
 | 
			
		||||
	Subnet           *SubResource `json:"subnet,omitempty"`
 | 
			
		||||
	NetworkInterface *SubResource `json:"networkInterface,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveNetworkSecurityGroupListResult is response for list effective
 | 
			
		||||
// network security groups api servive call
 | 
			
		||||
type EffectiveNetworkSecurityGroupListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string                          `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveNetworkSecurityRule is effective NetworkSecurityRules
 | 
			
		||||
type EffectiveNetworkSecurityRule struct {
 | 
			
		||||
	Name                             *string               `json:"name,omitempty"`
 | 
			
		||||
	Protocol                         SecurityRuleProtocol  `json:"protocol,omitempty"`
 | 
			
		||||
	SourcePortRange                  *string               `json:"sourcePortRange,omitempty"`
 | 
			
		||||
	DestinationPortRange             *string               `json:"destinationPortRange,omitempty"`
 | 
			
		||||
	SourceAddressPrefix              *string               `json:"sourceAddressPrefix,omitempty"`
 | 
			
		||||
	DestinationAddressPrefix         *string               `json:"destinationAddressPrefix,omitempty"`
 | 
			
		||||
	ExpandedSourceAddressPrefix      *[]string             `json:"expandedSourceAddressPrefix,omitempty"`
 | 
			
		||||
	ExpandedDestinationAddressPrefix *[]string             `json:"expandedDestinationAddressPrefix,omitempty"`
 | 
			
		||||
	Access                           SecurityRuleAccess    `json:"access,omitempty"`
 | 
			
		||||
	Priority                         *int32                `json:"priority,omitempty"`
 | 
			
		||||
	Direction                        SecurityRuleDirection `json:"direction,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveRoute is effective Route
 | 
			
		||||
type EffectiveRoute struct {
 | 
			
		||||
	Name             *string              `json:"name,omitempty"`
 | 
			
		||||
	Source           EffectiveRouteSource `json:"source,omitempty"`
 | 
			
		||||
	State            EffectiveRouteState  `json:"state,omitempty"`
 | 
			
		||||
	AddressPrefix    *[]string            `json:"addressPrefix,omitempty"`
 | 
			
		||||
	NextHopIPAddress *[]string            `json:"nextHopIpAddress,omitempty"`
 | 
			
		||||
	NextHopType      RouteNextHopType     `json:"nextHopType,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EffectiveRouteListResult is response for list effective route api servive
 | 
			
		||||
// call
 | 
			
		||||
type EffectiveRouteListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]EffectiveRoute `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string           `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Error is
 | 
			
		||||
type Error struct {
 | 
			
		||||
	Code       *string         `json:"code,omitempty"`
 | 
			
		||||
@@ -919,6 +1058,8 @@ type ExpressRouteCircuitPeeringPropertiesFormat struct {
 | 
			
		||||
	MicrosoftPeeringConfig     *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"`
 | 
			
		||||
	Stats                      *ExpressRouteCircuitStats         `json:"stats,omitempty"`
 | 
			
		||||
	ProvisioningState          *string                           `json:"provisioningState,omitempty"`
 | 
			
		||||
	GatewayManagerEtag         *string                           `json:"gatewayManagerEtag,omitempty"`
 | 
			
		||||
	LastModifiedBy             *string                           `json:"lastModifiedBy,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExpressRouteCircuitPropertiesFormat is properties of ExpressRouteCircuit
 | 
			
		||||
@@ -932,6 +1073,7 @@ type ExpressRouteCircuitPropertiesFormat struct {
 | 
			
		||||
	ServiceProviderNotes             *string                                       `json:"serviceProviderNotes,omitempty"`
 | 
			
		||||
	ServiceProviderProperties        *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"`
 | 
			
		||||
	ProvisioningState                *string                                       `json:"provisioningState,omitempty"`
 | 
			
		||||
	GatewayManagerEtag               *string                                       `json:"gatewayManagerEtag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ExpressRouteCircuitRoutesTable is the routes table associated with the
 | 
			
		||||
@@ -1119,7 +1261,7 @@ type Interface struct {
 | 
			
		||||
	Etag              *string                    `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// InterfaceDNSSettings is dns Settings of a network interface
 | 
			
		||||
// InterfaceDNSSettings is dns settings of a network interface
 | 
			
		||||
type InterfaceDNSSettings struct {
 | 
			
		||||
	DNSServers               *[]string `json:"dnsServers,omitempty"`
 | 
			
		||||
	AppliedDNSServers        *[]string `json:"appliedDnsServers,omitempty"`
 | 
			
		||||
@@ -1182,6 +1324,14 @@ type InterfacePropertiesFormat struct {
 | 
			
		||||
	ProvisioningState    *string                     `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IPAddressAvailabilityResult is response for CheckIPAddressAvailability Api
 | 
			
		||||
// service call
 | 
			
		||||
type IPAddressAvailabilityResult struct {
 | 
			
		||||
	autorest.Response    `json:"-"`
 | 
			
		||||
	Available            *bool     `json:"available,omitempty"`
 | 
			
		||||
	AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IPConfiguration is iPConfiguration
 | 
			
		||||
type IPConfiguration struct {
 | 
			
		||||
	ID         *string                          `json:"id,omitempty"`
 | 
			
		||||
@@ -1402,6 +1552,21 @@ type Resource struct {
 | 
			
		||||
	Tags     *map[string]*string `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ResourceNavigationLink is resourceNavigationLink resource
 | 
			
		||||
type ResourceNavigationLink struct {
 | 
			
		||||
	ID         *string                       `json:"id,omitempty"`
 | 
			
		||||
	Properties *ResourceNavigationLinkFormat `json:"properties,omitempty"`
 | 
			
		||||
	Name       *string                       `json:"name,omitempty"`
 | 
			
		||||
	Etag       *string                       `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ResourceNavigationLinkFormat is properties of ResourceNavigationLink
 | 
			
		||||
type ResourceNavigationLinkFormat struct {
 | 
			
		||||
	LinkedResourceType *string `json:"linkedResourceType,omitempty"`
 | 
			
		||||
	Link               *string `json:"link,omitempty"`
 | 
			
		||||
	ProvisioningState  *string `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Route is route resource
 | 
			
		||||
type Route struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
@@ -1598,11 +1763,12 @@ func (client SubnetListResult) SubnetListResultPreparer() (*http.Request, error)
 | 
			
		||||
 | 
			
		||||
// SubnetPropertiesFormat is
 | 
			
		||||
type SubnetPropertiesFormat struct {
 | 
			
		||||
	AddressPrefix        *string            `json:"addressPrefix,omitempty"`
 | 
			
		||||
	NetworkSecurityGroup *SecurityGroup     `json:"networkSecurityGroup,omitempty"`
 | 
			
		||||
	RouteTable           *RouteTable        `json:"routeTable,omitempty"`
 | 
			
		||||
	IPConfigurations     *[]IPConfiguration `json:"ipConfigurations,omitempty"`
 | 
			
		||||
	ProvisioningState    *string            `json:"provisioningState,omitempty"`
 | 
			
		||||
	AddressPrefix           *string                   `json:"addressPrefix,omitempty"`
 | 
			
		||||
	NetworkSecurityGroup    *SecurityGroup            `json:"networkSecurityGroup,omitempty"`
 | 
			
		||||
	RouteTable              *RouteTable               `json:"routeTable,omitempty"`
 | 
			
		||||
	IPConfigurations        *[]IPConfiguration        `json:"ipConfigurations,omitempty"`
 | 
			
		||||
	ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"`
 | 
			
		||||
	ProvisioningState       *string                   `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SubResource is
 | 
			
		||||
@@ -1628,7 +1794,7 @@ type UsageName struct {
 | 
			
		||||
type UsagesListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]Usage `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string  `json:",omitempty"`
 | 
			
		||||
	NextLink          *string  `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UsagesListResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
@@ -1731,7 +1897,6 @@ type VirtualNetworkGatewayIPConfiguration struct {
 | 
			
		||||
// VirtualNetworkGatewayIPConfigurationPropertiesFormat is properties of
 | 
			
		||||
// VirtualNetworkGatewayIPConfiguration
 | 
			
		||||
type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct {
 | 
			
		||||
	PrivateIPAddress          *string            `json:"privateIPAddress,omitempty"`
 | 
			
		||||
	PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"`
 | 
			
		||||
	Subnet                    *SubResource       `json:"subnet,omitempty"`
 | 
			
		||||
	PublicIPAddress           *SubResource       `json:"publicIPAddress,omitempty"`
 | 
			
		||||
@@ -1799,13 +1964,54 @@ func (client VirtualNetworkListResult) VirtualNetworkListResultPreparer() (*http
 | 
			
		||||
		autorest.WithBaseURL(to.String(client.NextLink)))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeering is peerings in a VirtualNework resource
 | 
			
		||||
type VirtualNetworkPeering struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	ID                *string                                `json:"id,omitempty"`
 | 
			
		||||
	Properties        *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"`
 | 
			
		||||
	Name              *string                                `json:"name,omitempty"`
 | 
			
		||||
	Etag              *string                                `json:"etag,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeeringListResult is response for ListSubnets Api service
 | 
			
		||||
// callRetrieves all subnet that belongs to a virtual network
 | 
			
		||||
type VirtualNetworkPeeringListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]VirtualNetworkPeering `json:"value,omitempty"`
 | 
			
		||||
	NextLink          *string                  `json:"nextLink,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. It returns
 | 
			
		||||
// nil if no more results exist.
 | 
			
		||||
func (client VirtualNetworkPeeringListResult) VirtualNetworkPeeringListResultPreparer() (*http.Request, error) {
 | 
			
		||||
	if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
 | 
			
		||||
		return nil, nil
 | 
			
		||||
	}
 | 
			
		||||
	return autorest.Prepare(&http.Request{},
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(to.String(client.NextLink)))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeeringPropertiesFormat is
 | 
			
		||||
type VirtualNetworkPeeringPropertiesFormat struct {
 | 
			
		||||
	AllowVirtualNetworkAccess *bool                      `json:"allowVirtualNetworkAccess,omitempty"`
 | 
			
		||||
	AllowForwardedTraffic     *bool                      `json:"allowForwardedTraffic,omitempty"`
 | 
			
		||||
	AllowGatewayTransit       *bool                      `json:"allowGatewayTransit,omitempty"`
 | 
			
		||||
	UseRemoteGateways         *bool                      `json:"useRemoteGateways,omitempty"`
 | 
			
		||||
	RemoteVirtualNetwork      *SubResource               `json:"remoteVirtualNetwork,omitempty"`
 | 
			
		||||
	PeeringState              VirtualNetworkPeeringState `json:"peeringState,omitempty"`
 | 
			
		||||
	ProvisioningState         *string                    `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPropertiesFormat is
 | 
			
		||||
type VirtualNetworkPropertiesFormat struct {
 | 
			
		||||
	AddressSpace      *AddressSpace `json:"addressSpace,omitempty"`
 | 
			
		||||
	DhcpOptions       *DhcpOptions  `json:"dhcpOptions,omitempty"`
 | 
			
		||||
	Subnets           *[]Subnet     `json:"subnets,omitempty"`
 | 
			
		||||
	ResourceGUID      *string       `json:"resourceGuid,omitempty"`
 | 
			
		||||
	ProvisioningState *string       `json:"provisioningState,omitempty"`
 | 
			
		||||
	AddressSpace           *AddressSpace            `json:"addressSpace,omitempty"`
 | 
			
		||||
	DhcpOptions            *DhcpOptions             `json:"dhcpOptions,omitempty"`
 | 
			
		||||
	Subnets                *[]Subnet                `json:"subnets,omitempty"`
 | 
			
		||||
	VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"VirtualNetworkPeerings,omitempty"`
 | 
			
		||||
	ResourceGUID           *string                  `json:"resourceGuid,omitempty"`
 | 
			
		||||
	ProvisioningState      *string                  `json:"provisioningState,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VpnClientConfiguration is vpnClientConfiguration for P2S client
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/publicipaddresses.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type PublicIPAddressesClient struct {
 | 
			
		||||
// NewPublicIPAddressesClient creates an instance of the
 | 
			
		||||
// PublicIPAddressesClient client.
 | 
			
		||||
func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient {
 | 
			
		||||
	return PublicIPAddressesClient{New(subscriptionID)}
 | 
			
		||||
	return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewPublicIPAddressesClientWithBaseURI creates an instance of the
 | 
			
		||||
// PublicIPAddressesClient client.
 | 
			
		||||
func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient {
 | 
			
		||||
	return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put PublicIPAddress operation creates/updates a
 | 
			
		||||
@@ -243,7 +249,7 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List publicIpAddress opertion retrieves all the publicIpAddresses
 | 
			
		||||
// List the List publicIpAddress operation retrieves all the publicIpAddresses
 | 
			
		||||
// in a resource group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
@@ -329,7 +335,7 @@ func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddres
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListAll the List publicIpAddress opertion retrieves all the
 | 
			
		||||
// ListAll the List publicIpAddress operation retrieves all the
 | 
			
		||||
// publicIpAddresses in a subscription.
 | 
			
		||||
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) {
 | 
			
		||||
	req, err := client.ListAllPreparer()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/routes.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -35,7 +35,12 @@ type RoutesClient struct {
 | 
			
		||||
 | 
			
		||||
// NewRoutesClient creates an instance of the RoutesClient client.
 | 
			
		||||
func NewRoutesClient(subscriptionID string) RoutesClient {
 | 
			
		||||
	return RoutesClient{New(subscriptionID)}
 | 
			
		||||
	return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client.
 | 
			
		||||
func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient {
 | 
			
		||||
	return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put route operation creates/updates a route in the
 | 
			
		||||
@@ -242,7 +247,7 @@ func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List network security rule opertion retrieves all the routes in a
 | 
			
		||||
// List the List network security rule operation retrieves all the routes in a
 | 
			
		||||
// route table.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. routeTableName is the
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/routetables.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -35,7 +35,13 @@ type RouteTablesClient struct {
 | 
			
		||||
 | 
			
		||||
// NewRouteTablesClient creates an instance of the RouteTablesClient client.
 | 
			
		||||
func NewRouteTablesClient(subscriptionID string) RouteTablesClient {
 | 
			
		||||
	return RouteTablesClient{New(subscriptionID)}
 | 
			
		||||
	return NewRouteTablesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewRouteTablesClientWithBaseURI creates an instance of the
 | 
			
		||||
// RouteTablesClient client.
 | 
			
		||||
func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) RouteTablesClient {
 | 
			
		||||
	return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put RouteTable operation creates/updates a route tablein
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/securitygroups.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type SecurityGroupsClient struct {
 | 
			
		||||
// NewSecurityGroupsClient creates an instance of the SecurityGroupsClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewSecurityGroupsClient(subscriptionID string) SecurityGroupsClient {
 | 
			
		||||
	return SecurityGroupsClient{New(subscriptionID)}
 | 
			
		||||
	return NewSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewSecurityGroupsClientWithBaseURI creates an instance of the
 | 
			
		||||
// SecurityGroupsClient client.
 | 
			
		||||
func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) SecurityGroupsClient {
 | 
			
		||||
	return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put NetworkSecurityGroup operation creates/updates a
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/securityrules.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type SecurityRulesClient struct {
 | 
			
		||||
// NewSecurityRulesClient creates an instance of the SecurityRulesClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewSecurityRulesClient(subscriptionID string) SecurityRulesClient {
 | 
			
		||||
	return SecurityRulesClient{New(subscriptionID)}
 | 
			
		||||
	return NewSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewSecurityRulesClientWithBaseURI creates an instance of the
 | 
			
		||||
// SecurityRulesClient client.
 | 
			
		||||
func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) SecurityRulesClient {
 | 
			
		||||
	return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put network security rule operation creates/updates a
 | 
			
		||||
@@ -248,7 +254,7 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List network security rule opertion retrieves all the security
 | 
			
		||||
// List the List network security rule operation retrieves all the security
 | 
			
		||||
// rules in a network security group.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -35,7 +35,12 @@ type SubnetsClient struct {
 | 
			
		||||
 | 
			
		||||
// NewSubnetsClient creates an instance of the SubnetsClient client.
 | 
			
		||||
func NewSubnetsClient(subscriptionID string) SubnetsClient {
 | 
			
		||||
	return SubnetsClient{New(subscriptionID)}
 | 
			
		||||
	return NewSubnetsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewSubnetsClientWithBaseURI creates an instance of the SubnetsClient client.
 | 
			
		||||
func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsClient {
 | 
			
		||||
	return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put Subnet operation creates/updates a subnet in
 | 
			
		||||
@@ -247,7 +252,7 @@ func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, er
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List subnets opertion retrieves all the subnets in a virtual
 | 
			
		||||
// List the List subnets operation retrieves all the subnets in a virtual
 | 
			
		||||
// network.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/usages.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -35,7 +35,12 @@ type UsagesClient struct {
 | 
			
		||||
 | 
			
		||||
// NewUsagesClient creates an instance of the UsagesClient client.
 | 
			
		||||
func NewUsagesClient(subscriptionID string) UsagesClient {
 | 
			
		||||
	return UsagesClient{New(subscriptionID)}
 | 
			
		||||
	return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client.
 | 
			
		||||
func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient {
 | 
			
		||||
	return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List lists compute usages for a subscription.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -24,7 +24,7 @@ import (
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	major = "3"
 | 
			
		||||
	minor = "0"
 | 
			
		||||
	minor = "2"
 | 
			
		||||
	patch = "0"
 | 
			
		||||
	// Always begin a "tag" with a dash (as per http://semver.org)
 | 
			
		||||
	tag             = "-beta"
 | 
			
		||||
@@ -34,7 +34,7 @@ const (
 | 
			
		||||
 | 
			
		||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
 | 
			
		||||
func UserAgent() string {
 | 
			
		||||
	return fmt.Sprintf(userAgentFormat, Version(), "network", "2016-03-30")
 | 
			
		||||
	return fmt.Sprintf(userAgentFormat, Version(), "network", "2016-06-01")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Version returns the semantic version (see http://semver.org) of the client.
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,13 @@ type VirtualNetworkGatewayConnectionsClient struct {
 | 
			
		||||
// NewVirtualNetworkGatewayConnectionsClient creates an instance of the
 | 
			
		||||
// VirtualNetworkGatewayConnectionsClient client.
 | 
			
		||||
func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string) VirtualNetworkGatewayConnectionsClient {
 | 
			
		||||
	return VirtualNetworkGatewayConnectionsClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualNetworkGatewayConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualNetworkGatewayConnectionsClientWithBaseURI creates an instance of
 | 
			
		||||
// the VirtualNetworkGatewayConnectionsClient client.
 | 
			
		||||
func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayConnectionsClient {
 | 
			
		||||
	return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put VirtualNetworkGatewayConnection operation
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,13 @@ type VirtualNetworkGatewaysClient struct {
 | 
			
		||||
// NewVirtualNetworkGatewaysClient creates an instance of the
 | 
			
		||||
// VirtualNetworkGatewaysClient client.
 | 
			
		||||
func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient {
 | 
			
		||||
	return VirtualNetworkGatewaysClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualNetworkGatewaysClient client.
 | 
			
		||||
func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient {
 | 
			
		||||
	return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put VirtualNetworkGateway operation creates/updates a
 | 
			
		||||
@@ -312,7 +318,7 @@ func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (re
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List VirtualNetworkGateways opertion retrieves all the virtual
 | 
			
		||||
// List the List VirtualNetworkGateways operation retrieves all the virtual
 | 
			
		||||
// network gateways stored.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										342
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										342
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkpeerings.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,342 @@
 | 
			
		||||
package network
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest/azure"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// VirtualNetworkPeeringsClient is the the Microsoft Azure Network management
 | 
			
		||||
// API provides a RESTful set of web services that interact with Microsoft
 | 
			
		||||
// Azure Networks service to manage your network resrources. The API has
 | 
			
		||||
// entities that capture the relationship between an end user and the
 | 
			
		||||
// Microsoft Azure Networks service.
 | 
			
		||||
type VirtualNetworkPeeringsClient struct {
 | 
			
		||||
	ManagementClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualNetworkPeeringsClient creates an instance of the
 | 
			
		||||
// VirtualNetworkPeeringsClient client.
 | 
			
		||||
func NewVirtualNetworkPeeringsClient(subscriptionID string) VirtualNetworkPeeringsClient {
 | 
			
		||||
	return NewVirtualNetworkPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualNetworkPeeringsClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualNetworkPeeringsClient client.
 | 
			
		||||
func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkPeeringsClient {
 | 
			
		||||
	return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put virtual network peering operation creates/updates a
 | 
			
		||||
// peering in the specified virtual network This method may poll for
 | 
			
		||||
// completion. Polling can be canceled by passing the cancel channel
 | 
			
		||||
// argument. The channel will be used to cancel polling and any outstanding
 | 
			
		||||
// HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
// the name of the virtual network. virtualNetworkPeeringName is the name of
 | 
			
		||||
// the peering. virtualNetworkPeeringParameters is parameters supplied to the
 | 
			
		||||
// create/update virtual network peering operation
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.CreateOrUpdateSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.CreateOrUpdateResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
		"virtualNetworkName":        autorest.Encode("path", virtualNetworkName),
 | 
			
		||||
		"virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsPut(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
 | 
			
		||||
		autorest.WithJSON(virtualNetworkPeeringParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{Cancel: cancel})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client,
 | 
			
		||||
		req,
 | 
			
		||||
		azure.DoPollForAsynchronous(client.PollingDelay))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Delete the delete virtual network peering operation deletes the specified
 | 
			
		||||
// peering. This method may poll for completion. Polling can be canceled by
 | 
			
		||||
// passing the cancel channel argument. The channel will be used to cancel
 | 
			
		||||
// polling and any outstanding HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
// the name of the virtual network. virtualNetworkPeeringName is the name of
 | 
			
		||||
// the virtual network peering.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) Delete(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, cancel)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.DeleteSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.DeleteResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeletePreparer prepares the Delete request.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
		"virtualNetworkName":        autorest.Encode("path", virtualNetworkName),
 | 
			
		||||
		"virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsDelete(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{Cancel: cancel})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteSender sends the Delete request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client,
 | 
			
		||||
		req,
 | 
			
		||||
		azure.DoPollForAsynchronous(client.PollingDelay))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteResponder handles the response to the Delete request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Get the Get virtual network peering operation retreives information about
 | 
			
		||||
// the specified virtual network peering.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
// the name of the virtual network. virtualNetworkPeeringName is the name of
 | 
			
		||||
// the virtual network peering.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) Get(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) {
 | 
			
		||||
	req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.GetSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.GetResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPreparer prepares the Get request.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
		"virtualNetworkName":        autorest.Encode("path", virtualNetworkName),
 | 
			
		||||
		"virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetSender sends the Get request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetResponder handles the response to the Get request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List the List virtual network peerings operation retrieves all the peerings
 | 
			
		||||
// in a virtual network.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
// the name of the virtual network.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResult, err error) {
 | 
			
		||||
	req, err := client.ListPreparer(resourceGroupName, virtualNetworkName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListPreparer prepares the List request.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
		"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListSender sends the List request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListResponder handles the response to the List request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (result VirtualNetworkPeeringListResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListNextResults retrieves the next set of results, if any.
 | 
			
		||||
func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) {
 | 
			
		||||
	req, err := lastResults.VirtualNetworkPeeringListResultPreparer()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request request")
 | 
			
		||||
	}
 | 
			
		||||
	if req == nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										76
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworks.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,7 +36,81 @@ type VirtualNetworksClient struct {
 | 
			
		||||
// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient {
 | 
			
		||||
	return VirtualNetworksClient{New(subscriptionID)}
 | 
			
		||||
	return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewVirtualNetworksClientWithBaseURI creates an instance of the
 | 
			
		||||
// VirtualNetworksClient client.
 | 
			
		||||
func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient {
 | 
			
		||||
	return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckIPAddressAvailability checks whether a private Ip address is available
 | 
			
		||||
// for use.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. virtualNetworkName is
 | 
			
		||||
// the name of the virtual network. ipAddress is the private IP address to be
 | 
			
		||||
// verified.
 | 
			
		||||
func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName string, virtualNetworkName string, ipAddress string) (result IPAddressAvailabilityResult, err error) {
 | 
			
		||||
	req, err := client.CheckIPAddressAvailabilityPreparer(resourceGroupName, virtualNetworkName, ipAddress)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.CheckIPAddressAvailabilitySender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.CheckIPAddressAvailabilityResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request.
 | 
			
		||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceGroupName string, virtualNetworkName string, ipAddress string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName":  autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":     autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
		"virtualNetworkName": autorest.Encode("path", virtualNetworkName),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
	if len(ipAddress) > 0 {
 | 
			
		||||
		queryParameters["ipAddress"] = autorest.Encode("query", ipAddress)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateOrUpdate the Put VirtualNetwork operation creates/updates a virtual
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										644
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										644
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/accounts.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,644 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest/azure"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// AccountsClient is the the Storage Management Client.
 | 
			
		||||
type AccountsClient struct {
 | 
			
		||||
	ManagementClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewAccountsClient creates an instance of the AccountsClient client.
 | 
			
		||||
func NewAccountsClient(subscriptionID string) AccountsClient {
 | 
			
		||||
	return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewAccountsClientWithBaseURI creates an instance of the AccountsClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient {
 | 
			
		||||
	return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckNameAvailability checks that account name is valid and is not in use.
 | 
			
		||||
//
 | 
			
		||||
// accountName is the name of the storage account within the specified
 | 
			
		||||
// resource group. Storage account names must be between 3 and 24 characters
 | 
			
		||||
// in length and use numbers and lower-case letters only.
 | 
			
		||||
func (client AccountsClient) CheckNameAvailability(accountName AccountCheckNameAvailabilityParameters) (result CheckNameAvailabilityResult, err error) {
 | 
			
		||||
	req, err := client.CheckNameAvailabilityPreparer(accountName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.CheckNameAvailabilitySender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.CheckNameAvailabilityResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "CheckNameAvailability", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request.
 | 
			
		||||
func (client AccountsClient) CheckNameAvailabilityPreparer(accountName AccountCheckNameAvailabilityParameters) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability", pathParameters),
 | 
			
		||||
		autorest.WithJSON(accountName),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Create asynchronously creates a new storage account with the specified
 | 
			
		||||
// parameters. If an account is already created and subsequent create request
 | 
			
		||||
// is issued with different properties, the account properties will be
 | 
			
		||||
// updated. If an account is already created and subsequent create or update
 | 
			
		||||
// request is issued with exact same set of properties, the request will
 | 
			
		||||
// succeed. This method may poll for completion. Polling can be canceled by
 | 
			
		||||
// passing the cancel channel argument. The channel will be used to cancel
 | 
			
		||||
// polling and any outstanding HTTP requests.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription. accountName is the name of the storage account within the
 | 
			
		||||
// specified resource group. Storage account names must be between 3 and 24
 | 
			
		||||
// characters in length and use numbers and lower-case letters only.
 | 
			
		||||
// parameters is the parameters to provide for the created account.
 | 
			
		||||
func (client AccountsClient) Create(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.CreatePreparer(resourceGroupName, accountName, parameters, cancel)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.CreateSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.CreateResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Create", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreatePreparer prepares the Create request.
 | 
			
		||||
func (client AccountsClient) CreatePreparer(resourceGroupName string, accountName string, parameters AccountCreateParameters, cancel <-chan struct{}) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsPut(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters),
 | 
			
		||||
		autorest.WithJSON(parameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{Cancel: cancel})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateSender sends the Create request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) CreateSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client,
 | 
			
		||||
		req,
 | 
			
		||||
		azure.DoPollForAsynchronous(client.PollingDelay))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateResponder handles the response to the Create request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Delete deletes a storage account in Microsoft Azure.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription. accountName is the name of the storage account within the
 | 
			
		||||
// specified resource group. Storage account names must be between 3 and 24
 | 
			
		||||
// characters in length and use numbers and lower-case letters only.
 | 
			
		||||
func (client AccountsClient) Delete(resourceGroupName string, accountName string) (result autorest.Response, err error) {
 | 
			
		||||
	req, err := client.DeletePreparer(resourceGroupName, accountName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.DeleteSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = resp
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.DeleteResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Delete", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeletePreparer prepares the Delete request.
 | 
			
		||||
func (client AccountsClient) DeletePreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsDelete(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteSender sends the Delete request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteResponder handles the response to the Delete request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = resp
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetProperties returns the properties for the specified storage account
 | 
			
		||||
// including but not limited to name, account type, location, and account
 | 
			
		||||
// status. The ListKeys operation should be used to retrieve storage keys.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription. accountName is the name of the storage account within the
 | 
			
		||||
// specified resource group. Storage account names must be between 3 and 24
 | 
			
		||||
// characters in length and use numbers and lower-case letters only.
 | 
			
		||||
func (client AccountsClient) GetProperties(resourceGroupName string, accountName string) (result Account, err error) {
 | 
			
		||||
	req, err := client.GetPropertiesPreparer(resourceGroupName, accountName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.GetPropertiesSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.GetPropertiesResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "GetProperties", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPropertiesPreparer prepares the GetProperties request.
 | 
			
		||||
func (client AccountsClient) GetPropertiesPreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPropertiesSender sends the GetProperties request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPropertiesResponder handles the response to the GetProperties request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List lists all the storage accounts available under the subscription. Note
 | 
			
		||||
// that storage keys are not returned; use the ListKeys operation for this.
 | 
			
		||||
func (client AccountsClient) List() (result AccountListResult, err error) {
 | 
			
		||||
	req, err := client.ListPreparer()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "List", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "List", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListPreparer prepares the List request.
 | 
			
		||||
func (client AccountsClient) ListPreparer() (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListSender sends the List request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListResponder handles the response to the List request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListByResourceGroup lists all the storage accounts available under the
 | 
			
		||||
// given resource group. Note that storage keys are not returned; use the
 | 
			
		||||
// ListKeys operation for this.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription.
 | 
			
		||||
func (client AccountsClient) ListByResourceGroup(resourceGroupName string) (result AccountListResult, err error) {
 | 
			
		||||
	req, err := client.ListByResourceGroupPreparer(resourceGroupName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListByResourceGroupSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListByResourceGroupResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListByResourceGroup", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
 | 
			
		||||
func (client AccountsClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListKeys lists the access keys for the specified storage account.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group. accountName is the
 | 
			
		||||
// name of the storage account.
 | 
			
		||||
func (client AccountsClient) ListKeys(resourceGroupName string, accountName string) (result AccountListKeysResult, err error) {
 | 
			
		||||
	req, err := client.ListKeysPreparer(resourceGroupName, accountName)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListKeysSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListKeysResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "ListKeys", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListKeysPreparer prepares the ListKeys request.
 | 
			
		||||
func (client AccountsClient) ListKeysPreparer(resourceGroupName string, accountName string) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListKeysSender sends the ListKeys request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListKeysResponder handles the response to the ListKeys request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RegenerateKey regenerates the access keys for the specified storage account.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription. accountName is the name of the storage account within the
 | 
			
		||||
// specified resource group. Storage account names must be between 3 and 24
 | 
			
		||||
// characters in length and use numbers and lower-case letters only.
 | 
			
		||||
// regenerateKey is specifies name of the key which should be regenerated.
 | 
			
		||||
// key1 or key2 for the default keys
 | 
			
		||||
func (client AccountsClient) RegenerateKey(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (result AccountListKeysResult, err error) {
 | 
			
		||||
	req, err := client.RegenerateKeyPreparer(resourceGroupName, accountName, regenerateKey)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.RegenerateKeySender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.RegenerateKeyResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "RegenerateKey", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RegenerateKeyPreparer prepares the RegenerateKey request.
 | 
			
		||||
func (client AccountsClient) RegenerateKeyPreparer(resourceGroupName string, accountName string, regenerateKey AccountRegenerateKeyParameters) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey", pathParameters),
 | 
			
		||||
		autorest.WithJSON(regenerateKey),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RegenerateKeySender sends the RegenerateKey request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Update the update operation can be used to update the account type,
 | 
			
		||||
// encryption, or tags for a storage account. It can also be used to map the
 | 
			
		||||
// account to a custom domain. Only one custom domain is supported per
 | 
			
		||||
// storage account and. replacement/change of custom domain is not supported.
 | 
			
		||||
// In order to replace an old custom domain, the old value must be
 | 
			
		||||
// cleared/unregistered before a new value may be set. Update of multiple
 | 
			
		||||
// properties is supported. This call does not change the storage keys for
 | 
			
		||||
// the account. If you want to change storage account keys, use the
 | 
			
		||||
// regenerate keys operation.  The location and name of the storage account
 | 
			
		||||
// cannot be changed after creation.
 | 
			
		||||
//
 | 
			
		||||
// resourceGroupName is the name of the resource group within the user's
 | 
			
		||||
// subscription. accountName is the name of the storage account within the
 | 
			
		||||
// specified resource group. Storage account names must be between 3 and 24
 | 
			
		||||
// characters in length and use numbers and lower-case letters only.
 | 
			
		||||
// parameters is the parameters to provide for the updated account.
 | 
			
		||||
func (client AccountsClient) Update(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (result Account, err error) {
 | 
			
		||||
	req, err := client.UpdatePreparer(resourceGroupName, accountName, parameters)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.UpdateSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.UpdateResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.AccountsClient", "Update", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdatePreparer prepares the Update request.
 | 
			
		||||
func (client AccountsClient) UpdatePreparer(resourceGroupName string, accountName string, parameters AccountUpdateParameters) (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"accountName":       autorest.Encode("path", accountName),
 | 
			
		||||
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
 | 
			
		||||
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsJSON(),
 | 
			
		||||
		autorest.AsPatch(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", pathParameters),
 | 
			
		||||
		autorest.WithJSON(parameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateSender sends the Update request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateResponder handles the response to the Update request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/client.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
// Package storage implements the Azure ARM Storage service API version
 | 
			
		||||
// 2016-01-01.
 | 
			
		||||
//
 | 
			
		||||
// The Storage Management Client.
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// APIVersion is the version of the Storage
 | 
			
		||||
	APIVersion = "2016-01-01"
 | 
			
		||||
 | 
			
		||||
	// DefaultBaseURI is the default URI used for the service Storage
 | 
			
		||||
	DefaultBaseURI = "https://management.azure.com"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ManagementClient is the base client for Storage.
 | 
			
		||||
type ManagementClient struct {
 | 
			
		||||
	autorest.Client
 | 
			
		||||
	BaseURI        string
 | 
			
		||||
	APIVersion     string
 | 
			
		||||
	SubscriptionID string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// New creates an instance of the ManagementClient client.
 | 
			
		||||
func New(subscriptionID string) ManagementClient {
 | 
			
		||||
	return NewWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewWithBaseURI creates an instance of the ManagementClient client.
 | 
			
		||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
 | 
			
		||||
	return ManagementClient{
 | 
			
		||||
		Client:         autorest.NewClientWithUserAgent(UserAgent()),
 | 
			
		||||
		BaseURI:        baseURI,
 | 
			
		||||
		APIVersion:     APIVersion,
 | 
			
		||||
		SubscriptionID: subscriptionID,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										295
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										295
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/models.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,295 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest/date"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// AccessTier enumerates the values for access tier.
 | 
			
		||||
type AccessTier string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Cool specifies the cool state for access tier.
 | 
			
		||||
	Cool AccessTier = "Cool"
 | 
			
		||||
	// Hot specifies the hot state for access tier.
 | 
			
		||||
	Hot AccessTier = "Hot"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// AccountStatus enumerates the values for account status.
 | 
			
		||||
type AccountStatus string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Available specifies the available state for account status.
 | 
			
		||||
	Available AccountStatus = "Available"
 | 
			
		||||
	// Unavailable specifies the unavailable state for account status.
 | 
			
		||||
	Unavailable AccountStatus = "Unavailable"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// KeyPermission enumerates the values for key permission.
 | 
			
		||||
type KeyPermission string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// FULL specifies the full state for key permission.
 | 
			
		||||
	FULL KeyPermission = "FULL"
 | 
			
		||||
	// READ specifies the read state for key permission.
 | 
			
		||||
	READ KeyPermission = "READ"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Kind enumerates the values for kind.
 | 
			
		||||
type Kind string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// BlobStorage specifies the blob storage state for kind.
 | 
			
		||||
	BlobStorage Kind = "BlobStorage"
 | 
			
		||||
	// Storage specifies the storage state for kind.
 | 
			
		||||
	Storage Kind = "Storage"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ProvisioningState enumerates the values for provisioning state.
 | 
			
		||||
type ProvisioningState string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Creating specifies the creating state for provisioning state.
 | 
			
		||||
	Creating ProvisioningState = "Creating"
 | 
			
		||||
	// ResolvingDNS specifies the resolving dns state for provisioning state.
 | 
			
		||||
	ResolvingDNS ProvisioningState = "ResolvingDNS"
 | 
			
		||||
	// Succeeded specifies the succeeded state for provisioning state.
 | 
			
		||||
	Succeeded ProvisioningState = "Succeeded"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Reason enumerates the values for reason.
 | 
			
		||||
type Reason string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// AccountNameInvalid specifies the account name invalid state for reason.
 | 
			
		||||
	AccountNameInvalid Reason = "AccountNameInvalid"
 | 
			
		||||
	// AlreadyExists specifies the already exists state for reason.
 | 
			
		||||
	AlreadyExists Reason = "AlreadyExists"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// SkuName enumerates the values for sku name.
 | 
			
		||||
type SkuName string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// PremiumLRS specifies the premium lrs state for sku name.
 | 
			
		||||
	PremiumLRS SkuName = "Premium_LRS"
 | 
			
		||||
	// StandardGRS specifies the standard grs state for sku name.
 | 
			
		||||
	StandardGRS SkuName = "Standard_GRS"
 | 
			
		||||
	// StandardLRS specifies the standard lrs state for sku name.
 | 
			
		||||
	StandardLRS SkuName = "Standard_LRS"
 | 
			
		||||
	// StandardRAGRS specifies the standard ragrs state for sku name.
 | 
			
		||||
	StandardRAGRS SkuName = "Standard_RAGRS"
 | 
			
		||||
	// StandardZRS specifies the standard zrs state for sku name.
 | 
			
		||||
	StandardZRS SkuName = "Standard_ZRS"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// SkuTier enumerates the values for sku tier.
 | 
			
		||||
type SkuTier string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Premium specifies the premium state for sku tier.
 | 
			
		||||
	Premium SkuTier = "Premium"
 | 
			
		||||
	// Standard specifies the standard state for sku tier.
 | 
			
		||||
	Standard SkuTier = "Standard"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// UsageUnit enumerates the values for usage unit.
 | 
			
		||||
type UsageUnit string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// Bytes specifies the bytes state for usage unit.
 | 
			
		||||
	Bytes UsageUnit = "Bytes"
 | 
			
		||||
	// BytesPerSecond specifies the bytes per second state for usage unit.
 | 
			
		||||
	BytesPerSecond UsageUnit = "BytesPerSecond"
 | 
			
		||||
	// Count specifies the count state for usage unit.
 | 
			
		||||
	Count UsageUnit = "Count"
 | 
			
		||||
	// CountsPerSecond specifies the counts per second state for usage unit.
 | 
			
		||||
	CountsPerSecond UsageUnit = "CountsPerSecond"
 | 
			
		||||
	// Percent specifies the percent state for usage unit.
 | 
			
		||||
	Percent UsageUnit = "Percent"
 | 
			
		||||
	// Seconds specifies the seconds state for usage unit.
 | 
			
		||||
	Seconds UsageUnit = "Seconds"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Account is the storage account.
 | 
			
		||||
type Account struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	ID                *string             `json:"id,omitempty"`
 | 
			
		||||
	Name              *string             `json:"name,omitempty"`
 | 
			
		||||
	Type              *string             `json:"type,omitempty"`
 | 
			
		||||
	Location          *string             `json:"location,omitempty"`
 | 
			
		||||
	Tags              *map[string]*string `json:"tags,omitempty"`
 | 
			
		||||
	Sku               *Sku                `json:"sku,omitempty"`
 | 
			
		||||
	Kind              Kind                `json:"kind,omitempty"`
 | 
			
		||||
	Properties        *AccountProperties  `json:"properties,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountCheckNameAvailabilityParameters is
 | 
			
		||||
type AccountCheckNameAvailabilityParameters struct {
 | 
			
		||||
	Name *string `json:"name,omitempty"`
 | 
			
		||||
	Type *string `json:"type,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountCreateParameters is the parameters to provide for the account.
 | 
			
		||||
type AccountCreateParameters struct {
 | 
			
		||||
	Sku        *Sku                               `json:"sku,omitempty"`
 | 
			
		||||
	Kind       Kind                               `json:"kind,omitempty"`
 | 
			
		||||
	Location   *string                            `json:"location,omitempty"`
 | 
			
		||||
	Tags       *map[string]*string                `json:"tags,omitempty"`
 | 
			
		||||
	Properties *AccountPropertiesCreateParameters `json:"properties,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountKey is an access key for the storage account.
 | 
			
		||||
type AccountKey struct {
 | 
			
		||||
	KeyName     *string       `json:"keyName,omitempty"`
 | 
			
		||||
	Value       *string       `json:"value,omitempty"`
 | 
			
		||||
	Permissions KeyPermission `json:"permissions,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountListKeysResult is the ListKeys operation response.
 | 
			
		||||
type AccountListKeysResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Keys              *[]AccountKey `json:"keys,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountListResult is the list storage accounts operation response.
 | 
			
		||||
type AccountListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]Account `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountProperties is
 | 
			
		||||
type AccountProperties struct {
 | 
			
		||||
	ProvisioningState   ProvisioningState `json:"provisioningState,omitempty"`
 | 
			
		||||
	PrimaryEndpoints    *Endpoints        `json:"primaryEndpoints,omitempty"`
 | 
			
		||||
	PrimaryLocation     *string           `json:"primaryLocation,omitempty"`
 | 
			
		||||
	StatusOfPrimary     AccountStatus     `json:"statusOfPrimary,omitempty"`
 | 
			
		||||
	LastGeoFailoverTime *date.Time        `json:"lastGeoFailoverTime,omitempty"`
 | 
			
		||||
	SecondaryLocation   *string           `json:"secondaryLocation,omitempty"`
 | 
			
		||||
	StatusOfSecondary   AccountStatus     `json:"statusOfSecondary,omitempty"`
 | 
			
		||||
	CreationTime        *date.Time        `json:"creationTime,omitempty"`
 | 
			
		||||
	CustomDomain        *CustomDomain     `json:"customDomain,omitempty"`
 | 
			
		||||
	SecondaryEndpoints  *Endpoints        `json:"secondaryEndpoints,omitempty"`
 | 
			
		||||
	Encryption          *Encryption       `json:"encryption,omitempty"`
 | 
			
		||||
	AccessTier          AccessTier        `json:"accessTier,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountPropertiesCreateParameters is
 | 
			
		||||
type AccountPropertiesCreateParameters struct {
 | 
			
		||||
	CustomDomain *CustomDomain `json:"customDomain,omitempty"`
 | 
			
		||||
	Encryption   *Encryption   `json:"encryption,omitempty"`
 | 
			
		||||
	AccessTier   AccessTier    `json:"accessTier,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountPropertiesUpdateParameters is
 | 
			
		||||
type AccountPropertiesUpdateParameters struct {
 | 
			
		||||
	CustomDomain *CustomDomain `json:"customDomain,omitempty"`
 | 
			
		||||
	Encryption   *Encryption   `json:"encryption,omitempty"`
 | 
			
		||||
	AccessTier   AccessTier    `json:"accessTier,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountRegenerateKeyParameters is
 | 
			
		||||
type AccountRegenerateKeyParameters struct {
 | 
			
		||||
	KeyName *string `json:"keyName,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AccountUpdateParameters is the parameters to provide for the account.
 | 
			
		||||
type AccountUpdateParameters struct {
 | 
			
		||||
	Sku        *Sku                               `json:"sku,omitempty"`
 | 
			
		||||
	Tags       *map[string]*string                `json:"tags,omitempty"`
 | 
			
		||||
	Properties *AccountPropertiesUpdateParameters `json:"properties,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CheckNameAvailabilityResult is the CheckNameAvailability operation response.
 | 
			
		||||
type CheckNameAvailabilityResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	NameAvailable     *bool   `json:"nameAvailable,omitempty"`
 | 
			
		||||
	Reason            Reason  `json:"reason,omitempty"`
 | 
			
		||||
	Message           *string `json:"message,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CustomDomain is the custom domain assigned to this storage account. This
 | 
			
		||||
// can be set via Update.
 | 
			
		||||
type CustomDomain struct {
 | 
			
		||||
	Name         *string `json:"name,omitempty"`
 | 
			
		||||
	UseSubDomain *bool   `json:"useSubDomain,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Encryption is the encryption settings on the account.
 | 
			
		||||
type Encryption struct {
 | 
			
		||||
	Services  *EncryptionServices `json:"services,omitempty"`
 | 
			
		||||
	KeySource *string             `json:"keySource,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncryptionService is an encrypted service.
 | 
			
		||||
type EncryptionService struct {
 | 
			
		||||
	Enabled         *bool      `json:"enabled,omitempty"`
 | 
			
		||||
	LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EncryptionServices is the encrypted services.
 | 
			
		||||
type EncryptionServices struct {
 | 
			
		||||
	Blob *EncryptionService `json:"blob,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Endpoints is the URIs that are used to perform a retrieval of a public
 | 
			
		||||
// blob, queue or table object.
 | 
			
		||||
type Endpoints struct {
 | 
			
		||||
	Blob  *string `json:"blob,omitempty"`
 | 
			
		||||
	Queue *string `json:"queue,omitempty"`
 | 
			
		||||
	Table *string `json:"table,omitempty"`
 | 
			
		||||
	File  *string `json:"file,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Resource is
 | 
			
		||||
type Resource struct {
 | 
			
		||||
	ID       *string             `json:"id,omitempty"`
 | 
			
		||||
	Name     *string             `json:"name,omitempty"`
 | 
			
		||||
	Type     *string             `json:"type,omitempty"`
 | 
			
		||||
	Location *string             `json:"location,omitempty"`
 | 
			
		||||
	Tags     *map[string]*string `json:"tags,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Sku is the SKU of the storage account.
 | 
			
		||||
type Sku struct {
 | 
			
		||||
	Name SkuName `json:"name,omitempty"`
 | 
			
		||||
	Tier SkuTier `json:"tier,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Usage is describes Storage Resource Usage.
 | 
			
		||||
type Usage struct {
 | 
			
		||||
	Unit         UsageUnit  `json:"unit,omitempty"`
 | 
			
		||||
	CurrentValue *int32     `json:"currentValue,omitempty"`
 | 
			
		||||
	Limit        *int32     `json:"limit,omitempty"`
 | 
			
		||||
	Name         *UsageName `json:"name,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UsageListResult is the List Usages operation response.
 | 
			
		||||
type UsageListResult struct {
 | 
			
		||||
	autorest.Response `json:"-"`
 | 
			
		||||
	Value             *[]Usage `json:"value,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UsageName is the Usage Names.
 | 
			
		||||
type UsageName struct {
 | 
			
		||||
	Value          *string `json:"value,omitempty"`
 | 
			
		||||
	LocalizedValue *string `json:"localizedValue,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										101
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usageoperations.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/usageoperations.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,101 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest/azure"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// UsageOperationsClient is the the Storage Management Client.
 | 
			
		||||
type UsageOperationsClient struct {
 | 
			
		||||
	ManagementClient
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewUsageOperationsClient creates an instance of the UsageOperationsClient
 | 
			
		||||
// client.
 | 
			
		||||
func NewUsageOperationsClient(subscriptionID string) UsageOperationsClient {
 | 
			
		||||
	return NewUsageOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewUsageOperationsClientWithBaseURI creates an instance of the
 | 
			
		||||
// UsageOperationsClient client.
 | 
			
		||||
func NewUsageOperationsClientWithBaseURI(baseURI string, subscriptionID string) UsageOperationsClient {
 | 
			
		||||
	return UsageOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// List gets the current usage count and the limit for the resources under the
 | 
			
		||||
// subscription.
 | 
			
		||||
func (client UsageOperationsClient) List() (result UsageListResult, err error) {
 | 
			
		||||
	req, err := client.ListPreparer()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", nil, "Failure preparing request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := client.ListSender(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		result.Response = autorest.Response{Response: resp}
 | 
			
		||||
		return result, autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", resp, "Failure sending request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result, err = client.ListResponder(resp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		err = autorest.NewErrorWithError(err, "storage.UsageOperationsClient", "List", resp, "Failure responding to request")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListPreparer prepares the List request.
 | 
			
		||||
func (client UsageOperationsClient) ListPreparer() (*http.Request, error) {
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": client.APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsGet(),
 | 
			
		||||
		autorest.WithBaseURL(client.BaseURI),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters))
 | 
			
		||||
	return preparer.Prepare(&http.Request{})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListSender sends the List request. The method will close the
 | 
			
		||||
// http.Response Body if it receives an error.
 | 
			
		||||
func (client UsageOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
 | 
			
		||||
	return autorest.SendWithSender(client, req)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ListResponder handles the response to the List request. The method always
 | 
			
		||||
// closes the http.Response Body.
 | 
			
		||||
func (client UsageOperationsClient) ListResponder(resp *http.Response) (result UsageListResult, err error) {
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		client.ByInspecting(),
 | 
			
		||||
		azure.WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&result),
 | 
			
		||||
		autorest.ByClosing())
 | 
			
		||||
	result.Response = autorest.Response{Response: resp}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								vendor/github.com/Azure/azure-sdk-for-go/arm/storage/version.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
// Copyright (c) Microsoft and contributors.  All rights reserved.
 | 
			
		||||
//
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
//
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
//
 | 
			
		||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
 | 
			
		||||
// Changes may cause incorrect behavior and will be lost if the code is
 | 
			
		||||
// regenerated.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	major = "3"
 | 
			
		||||
	minor = "2"
 | 
			
		||||
	patch = "0"
 | 
			
		||||
	// Always begin a "tag" with a dash (as per http://semver.org)
 | 
			
		||||
	tag             = "-beta"
 | 
			
		||||
	semVerFormat    = "%s.%s.%s%s"
 | 
			
		||||
	userAgentFormat = "Azure-SDK-for-Go/%s arm-%s/%s"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
 | 
			
		||||
func UserAgent() string {
 | 
			
		||||
	return fmt.Sprintf(userAgentFormat, Version(), "storage", "2016-01-01")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Version returns the semantic version (see http://semver.org) of the client.
 | 
			
		||||
func Version() string {
 | 
			
		||||
	return fmt.Sprintf(semVerFormat, major, minor, patch, tag)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1133
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1133
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										551
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/client.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										551
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/client.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,551 @@
 | 
			
		||||
// Package storage provides clients for Microsoft Azure Storage Services.
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"encoding/xml"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"sort"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// DefaultBaseURL is the domain name used for storage requests when a
 | 
			
		||||
	// default client is created.
 | 
			
		||||
	DefaultBaseURL = "core.windows.net"
 | 
			
		||||
 | 
			
		||||
	// DefaultAPIVersion is the  Azure Storage API version string used when a
 | 
			
		||||
	// basic client is created.
 | 
			
		||||
	DefaultAPIVersion = "2015-02-21"
 | 
			
		||||
 | 
			
		||||
	defaultUseHTTPS = true
 | 
			
		||||
 | 
			
		||||
	// StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator
 | 
			
		||||
	StorageEmulatorAccountName = "devstoreaccount1"
 | 
			
		||||
 | 
			
		||||
	// StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator
 | 
			
		||||
	StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
 | 
			
		||||
 | 
			
		||||
	blobServiceName  = "blob"
 | 
			
		||||
	tableServiceName = "table"
 | 
			
		||||
	queueServiceName = "queue"
 | 
			
		||||
	fileServiceName  = "file"
 | 
			
		||||
 | 
			
		||||
	storageEmulatorBlob  = "127.0.0.1:10000"
 | 
			
		||||
	storageEmulatorTable = "127.0.0.1:10002"
 | 
			
		||||
	storageEmulatorQueue = "127.0.0.1:10001"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Client is the object that needs to be constructed to perform
 | 
			
		||||
// operations on the storage account.
 | 
			
		||||
type Client struct {
 | 
			
		||||
	// HTTPClient is the http.Client used to initiate API
 | 
			
		||||
	// requests.  If it is nil, http.DefaultClient is used.
 | 
			
		||||
	HTTPClient *http.Client
 | 
			
		||||
 | 
			
		||||
	accountName string
 | 
			
		||||
	accountKey  []byte
 | 
			
		||||
	useHTTPS    bool
 | 
			
		||||
	baseURL     string
 | 
			
		||||
	apiVersion  string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type storageResponse struct {
 | 
			
		||||
	statusCode int
 | 
			
		||||
	headers    http.Header
 | 
			
		||||
	body       io.ReadCloser
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type odataResponse struct {
 | 
			
		||||
	storageResponse
 | 
			
		||||
	odata odataErrorMessage
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AzureStorageServiceError contains fields of the error response from
 | 
			
		||||
// Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx
 | 
			
		||||
// Some fields might be specific to certain calls.
 | 
			
		||||
type AzureStorageServiceError struct {
 | 
			
		||||
	Code                      string `xml:"Code"`
 | 
			
		||||
	Message                   string `xml:"Message"`
 | 
			
		||||
	AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"`
 | 
			
		||||
	QueryParameterName        string `xml:"QueryParameterName"`
 | 
			
		||||
	QueryParameterValue       string `xml:"QueryParameterValue"`
 | 
			
		||||
	Reason                    string `xml:"Reason"`
 | 
			
		||||
	StatusCode                int
 | 
			
		||||
	RequestID                 string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type odataErrorMessageMessage struct {
 | 
			
		||||
	Lang  string `json:"lang"`
 | 
			
		||||
	Value string `json:"value"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type odataErrorMessageInternal struct {
 | 
			
		||||
	Code    string                   `json:"code"`
 | 
			
		||||
	Message odataErrorMessageMessage `json:"message"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type odataErrorMessage struct {
 | 
			
		||||
	Err odataErrorMessageInternal `json:"odata.error"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnexpectedStatusCodeError is returned when a storage service responds with neither an error
 | 
			
		||||
// nor with an HTTP status code indicating success.
 | 
			
		||||
type UnexpectedStatusCodeError struct {
 | 
			
		||||
	allowed []int
 | 
			
		||||
	got     int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e UnexpectedStatusCodeError) Error() string {
 | 
			
		||||
	s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) }
 | 
			
		||||
 | 
			
		||||
	got := s(e.got)
 | 
			
		||||
	expected := []string{}
 | 
			
		||||
	for _, v := range e.allowed {
 | 
			
		||||
		expected = append(expected, s(v))
 | 
			
		||||
	}
 | 
			
		||||
	return fmt.Sprintf("storage: status code from service response is %s; was expecting %s", got, strings.Join(expected, " or "))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Got is the actual status code returned by Azure.
 | 
			
		||||
func (e UnexpectedStatusCodeError) Got() int {
 | 
			
		||||
	return e.got
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewBasicClient constructs a Client with given storage service name and
 | 
			
		||||
// key.
 | 
			
		||||
func NewBasicClient(accountName, accountKey string) (Client, error) {
 | 
			
		||||
	if accountName == StorageEmulatorAccountName {
 | 
			
		||||
		return NewEmulatorClient()
 | 
			
		||||
	}
 | 
			
		||||
	return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//NewEmulatorClient contructs a Client intended to only work with Azure
 | 
			
		||||
//Storage Emulator
 | 
			
		||||
func NewEmulatorClient() (Client, error) {
 | 
			
		||||
	return NewClient(StorageEmulatorAccountName, StorageEmulatorAccountKey, DefaultBaseURL, DefaultAPIVersion, false)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewClient constructs a Client. This should be used if the caller wants
 | 
			
		||||
// to specify whether to use HTTPS, a specific REST API version or a custom
 | 
			
		||||
// storage endpoint than Azure Public Cloud.
 | 
			
		||||
func NewClient(accountName, accountKey, blobServiceBaseURL, apiVersion string, useHTTPS bool) (Client, error) {
 | 
			
		||||
	var c Client
 | 
			
		||||
	if accountName == "" {
 | 
			
		||||
		return c, fmt.Errorf("azure: account name required")
 | 
			
		||||
	} else if accountKey == "" {
 | 
			
		||||
		return c, fmt.Errorf("azure: account key required")
 | 
			
		||||
	} else if blobServiceBaseURL == "" {
 | 
			
		||||
		return c, fmt.Errorf("azure: base storage service url required")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	key, err := base64.StdEncoding.DecodeString(accountKey)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return c, fmt.Errorf("azure: malformed storage account key: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return Client{
 | 
			
		||||
		accountName: accountName,
 | 
			
		||||
		accountKey:  key,
 | 
			
		||||
		useHTTPS:    useHTTPS,
 | 
			
		||||
		baseURL:     blobServiceBaseURL,
 | 
			
		||||
		apiVersion:  apiVersion,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) getBaseURL(service string) string {
 | 
			
		||||
	scheme := "http"
 | 
			
		||||
	if c.useHTTPS {
 | 
			
		||||
		scheme = "https"
 | 
			
		||||
	}
 | 
			
		||||
	host := ""
 | 
			
		||||
	if c.accountName == StorageEmulatorAccountName {
 | 
			
		||||
		switch service {
 | 
			
		||||
		case blobServiceName:
 | 
			
		||||
			host = storageEmulatorBlob
 | 
			
		||||
		case tableServiceName:
 | 
			
		||||
			host = storageEmulatorTable
 | 
			
		||||
		case queueServiceName:
 | 
			
		||||
			host = storageEmulatorQueue
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		host = fmt.Sprintf("%s.%s.%s", c.accountName, service, c.baseURL)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	u := &url.URL{
 | 
			
		||||
		Scheme: scheme,
 | 
			
		||||
		Host:   host}
 | 
			
		||||
	return u.String()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) getEndpoint(service, path string, params url.Values) string {
 | 
			
		||||
	u, err := url.Parse(c.getBaseURL(service))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		// really should not be happening
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// API doesn't accept path segments not starting with '/'
 | 
			
		||||
	if !strings.HasPrefix(path, "/") {
 | 
			
		||||
		path = fmt.Sprintf("/%v", path)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if c.accountName == StorageEmulatorAccountName {
 | 
			
		||||
		path = fmt.Sprintf("/%v%v", StorageEmulatorAccountName, path)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	u.Path = path
 | 
			
		||||
	u.RawQuery = params.Encode()
 | 
			
		||||
	return u.String()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetBlobService returns a BlobStorageClient which can operate on the blob
 | 
			
		||||
// service of the storage account.
 | 
			
		||||
func (c Client) GetBlobService() BlobStorageClient {
 | 
			
		||||
	return BlobStorageClient{c}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetQueueService returns a QueueServiceClient which can operate on the queue
 | 
			
		||||
// service of the storage account.
 | 
			
		||||
func (c Client) GetQueueService() QueueServiceClient {
 | 
			
		||||
	return QueueServiceClient{c}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetTableService returns a TableServiceClient which can operate on the table
 | 
			
		||||
// service of the storage account.
 | 
			
		||||
func (c Client) GetTableService() TableServiceClient {
 | 
			
		||||
	return TableServiceClient{c}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetFileService returns a FileServiceClient which can operate on the file
 | 
			
		||||
// service of the storage account.
 | 
			
		||||
func (c Client) GetFileService() FileServiceClient {
 | 
			
		||||
	return FileServiceClient{c}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) createAuthorizationHeader(canonicalizedString string) string {
 | 
			
		||||
	signature := c.computeHmac256(canonicalizedString)
 | 
			
		||||
	return fmt.Sprintf("%s %s:%s", "SharedKey", c.getCanonicalizedAccountName(), signature)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) getAuthorizationHeader(verb, url string, headers map[string]string) (string, error) {
 | 
			
		||||
	canonicalizedResource, err := c.buildCanonicalizedResource(url)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	canonicalizedString := c.buildCanonicalizedString(verb, headers, canonicalizedResource)
 | 
			
		||||
	return c.createAuthorizationHeader(canonicalizedString), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) getStandardHeaders() map[string]string {
 | 
			
		||||
	return map[string]string{
 | 
			
		||||
		"x-ms-version": c.apiVersion,
 | 
			
		||||
		"x-ms-date":    currentTimeRfc1123Formatted(),
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) getCanonicalizedAccountName() string {
 | 
			
		||||
	// since we may be trying to access a secondary storage account, we need to
 | 
			
		||||
	// remove the -secondary part of the storage name
 | 
			
		||||
	return strings.TrimSuffix(c.accountName, "-secondary")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) buildCanonicalizedHeader(headers map[string]string) string {
 | 
			
		||||
	cm := make(map[string]string)
 | 
			
		||||
 | 
			
		||||
	for k, v := range headers {
 | 
			
		||||
		headerName := strings.TrimSpace(strings.ToLower(k))
 | 
			
		||||
		match, _ := regexp.MatchString("x-ms-", headerName)
 | 
			
		||||
		if match {
 | 
			
		||||
			cm[headerName] = v
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(cm) == 0 {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	keys := make([]string, 0, len(cm))
 | 
			
		||||
	for key := range cm {
 | 
			
		||||
		keys = append(keys, key)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sort.Strings(keys)
 | 
			
		||||
 | 
			
		||||
	ch := ""
 | 
			
		||||
 | 
			
		||||
	for i, key := range keys {
 | 
			
		||||
		if i == len(keys)-1 {
 | 
			
		||||
			ch += fmt.Sprintf("%s:%s", key, cm[key])
 | 
			
		||||
		} else {
 | 
			
		||||
			ch += fmt.Sprintf("%s:%s\n", key, cm[key])
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return ch
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) buildCanonicalizedResourceTable(uri string) (string, error) {
 | 
			
		||||
	errMsg := "buildCanonicalizedResourceTable error: %s"
 | 
			
		||||
	u, err := url.Parse(uri)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", fmt.Errorf(errMsg, err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cr := "/" + c.getCanonicalizedAccountName()
 | 
			
		||||
 | 
			
		||||
	if len(u.Path) > 0 {
 | 
			
		||||
		cr += u.Path
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return cr, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) buildCanonicalizedResource(uri string) (string, error) {
 | 
			
		||||
	errMsg := "buildCanonicalizedResource error: %s"
 | 
			
		||||
	u, err := url.Parse(uri)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", fmt.Errorf(errMsg, err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cr := "/" + c.getCanonicalizedAccountName()
 | 
			
		||||
 | 
			
		||||
	if len(u.Path) > 0 {
 | 
			
		||||
		// Any portion of the CanonicalizedResource string that is derived from
 | 
			
		||||
		// the resource's URI should be encoded exactly as it is in the URI.
 | 
			
		||||
		// -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx
 | 
			
		||||
		cr += u.EscapedPath()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	params, err := url.ParseQuery(u.RawQuery)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", fmt.Errorf(errMsg, err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(params) > 0 {
 | 
			
		||||
		cr += "\n"
 | 
			
		||||
		keys := make([]string, 0, len(params))
 | 
			
		||||
		for key := range params {
 | 
			
		||||
			keys = append(keys, key)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		sort.Strings(keys)
 | 
			
		||||
 | 
			
		||||
		for i, key := range keys {
 | 
			
		||||
			if len(params[key]) > 1 {
 | 
			
		||||
				sort.Strings(params[key])
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if i == len(keys)-1 {
 | 
			
		||||
				cr += fmt.Sprintf("%s:%s", key, strings.Join(params[key], ","))
 | 
			
		||||
			} else {
 | 
			
		||||
				cr += fmt.Sprintf("%s:%s\n", key, strings.Join(params[key], ","))
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return cr, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string) string {
 | 
			
		||||
	contentLength := headers["Content-Length"]
 | 
			
		||||
	if contentLength == "0" {
 | 
			
		||||
		contentLength = ""
 | 
			
		||||
	}
 | 
			
		||||
	canonicalizedString := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
 | 
			
		||||
		verb,
 | 
			
		||||
		headers["Content-Encoding"],
 | 
			
		||||
		headers["Content-Language"],
 | 
			
		||||
		contentLength,
 | 
			
		||||
		headers["Content-MD5"],
 | 
			
		||||
		headers["Content-Type"],
 | 
			
		||||
		headers["Date"],
 | 
			
		||||
		headers["If-Modified-Since"],
 | 
			
		||||
		headers["If-Match"],
 | 
			
		||||
		headers["If-None-Match"],
 | 
			
		||||
		headers["If-Unmodified-Since"],
 | 
			
		||||
		headers["Range"],
 | 
			
		||||
		c.buildCanonicalizedHeader(headers),
 | 
			
		||||
		canonicalizedResource)
 | 
			
		||||
 | 
			
		||||
	return canonicalizedString
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) exec(verb, url string, headers map[string]string, body io.Reader) (*storageResponse, error) {
 | 
			
		||||
	authHeader, err := c.getAuthorizationHeader(verb, url, headers)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	headers["Authorization"] = authHeader
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	req, err := http.NewRequest(verb, url, body)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, errors.New("azure/storage: error creating request: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if clstr, ok := headers["Content-Length"]; ok {
 | 
			
		||||
		// content length header is being signed, but completely ignored by golang.
 | 
			
		||||
		// instead we have to use the ContentLength property on the request struct
 | 
			
		||||
		// (see https://golang.org/src/net/http/request.go?s=18140:18370#L536 and
 | 
			
		||||
		// https://golang.org/src/net/http/transfer.go?s=1739:2467#L49)
 | 
			
		||||
		req.ContentLength, err = strconv.ParseInt(clstr, 10, 64)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	for k, v := range headers {
 | 
			
		||||
		req.Header.Add(k, v)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	httpClient := c.HTTPClient
 | 
			
		||||
	if httpClient == nil {
 | 
			
		||||
		httpClient = http.DefaultClient
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := httpClient.Do(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	statusCode := resp.StatusCode
 | 
			
		||||
	if statusCode >= 400 && statusCode <= 505 {
 | 
			
		||||
		var respBody []byte
 | 
			
		||||
		respBody, err = readResponseBody(resp)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(respBody) == 0 {
 | 
			
		||||
			// no error in response body
 | 
			
		||||
			err = fmt.Errorf("storage: service returned without a response body (%s)", resp.Status)
 | 
			
		||||
		} else {
 | 
			
		||||
			// response contains storage service error object, unmarshal
 | 
			
		||||
			storageErr, errIn := serviceErrFromXML(respBody, resp.StatusCode, resp.Header.Get("x-ms-request-id"))
 | 
			
		||||
			if err != nil { // error unmarshaling the error response
 | 
			
		||||
				err = errIn
 | 
			
		||||
			}
 | 
			
		||||
			err = storageErr
 | 
			
		||||
		}
 | 
			
		||||
		return &storageResponse{
 | 
			
		||||
			statusCode: resp.StatusCode,
 | 
			
		||||
			headers:    resp.Header,
 | 
			
		||||
			body:       ioutil.NopCloser(bytes.NewReader(respBody)), /* restore the body */
 | 
			
		||||
		}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &storageResponse{
 | 
			
		||||
		statusCode: resp.StatusCode,
 | 
			
		||||
		headers:    resp.Header,
 | 
			
		||||
		body:       resp.Body}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader) (*odataResponse, error) {
 | 
			
		||||
	req, err := http.NewRequest(verb, url, body)
 | 
			
		||||
	for k, v := range headers {
 | 
			
		||||
		req.Header.Add(k, v)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	httpClient := c.HTTPClient
 | 
			
		||||
	if httpClient == nil {
 | 
			
		||||
		httpClient = http.DefaultClient
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := httpClient.Do(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	respToRet := &odataResponse{}
 | 
			
		||||
	respToRet.body = resp.Body
 | 
			
		||||
	respToRet.statusCode = resp.StatusCode
 | 
			
		||||
	respToRet.headers = resp.Header
 | 
			
		||||
 | 
			
		||||
	statusCode := resp.StatusCode
 | 
			
		||||
	if statusCode >= 400 && statusCode <= 505 {
 | 
			
		||||
		var respBody []byte
 | 
			
		||||
		respBody, err = readResponseBody(resp)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(respBody) == 0 {
 | 
			
		||||
			// no error in response body
 | 
			
		||||
			err = fmt.Errorf("storage: service returned without a response body (%d)", resp.StatusCode)
 | 
			
		||||
			return respToRet, err
 | 
			
		||||
		}
 | 
			
		||||
		// try unmarshal as odata.error json
 | 
			
		||||
		err = json.Unmarshal(respBody, &respToRet.odata)
 | 
			
		||||
		return respToRet, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return respToRet, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) createSharedKeyLite(url string, headers map[string]string) (string, error) {
 | 
			
		||||
	can, err := c.buildCanonicalizedResourceTable(url)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	strToSign := headers["x-ms-date"] + "\n" + can
 | 
			
		||||
 | 
			
		||||
	hmac := c.computeHmac256(strToSign)
 | 
			
		||||
	return fmt.Sprintf("SharedKeyLite %s:%s", c.accountName, hmac), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c Client) execTable(verb, url string, headers map[string]string, body io.Reader) (*odataResponse, error) {
 | 
			
		||||
	var err error
 | 
			
		||||
	headers["Authorization"], err = c.createSharedKeyLite(url, headers)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return c.execInternalJSON(verb, url, headers, body)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func readResponseBody(resp *http.Response) ([]byte, error) {
 | 
			
		||||
	defer resp.Body.Close()
 | 
			
		||||
	out, err := ioutil.ReadAll(resp.Body)
 | 
			
		||||
	if err == io.EOF {
 | 
			
		||||
		err = nil
 | 
			
		||||
	}
 | 
			
		||||
	return out, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func serviceErrFromXML(body []byte, statusCode int, requestID string) (AzureStorageServiceError, error) {
 | 
			
		||||
	var storageErr AzureStorageServiceError
 | 
			
		||||
	if err := xml.Unmarshal(body, &storageErr); err != nil {
 | 
			
		||||
		return storageErr, err
 | 
			
		||||
	}
 | 
			
		||||
	storageErr.StatusCode = statusCode
 | 
			
		||||
	storageErr.RequestID = requestID
 | 
			
		||||
	return storageErr, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e AzureStorageServiceError) Error() string {
 | 
			
		||||
	return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestId=%s, QueryParameterName=%s, QueryParameterValue=%s",
 | 
			
		||||
		e.StatusCode, e.Code, e.Message, e.RequestID, e.QueryParameterName, e.QueryParameterValue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// checkRespCode returns UnexpectedStatusError if the given response code is not
 | 
			
		||||
// one of the allowed status codes; otherwise nil.
 | 
			
		||||
func checkRespCode(respCode int, allowed []int) error {
 | 
			
		||||
	for _, v := range allowed {
 | 
			
		||||
		if respCode == v {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return UnexpectedStatusCodeError{allowed, respCode}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										106
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/file.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/file.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,106 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// FileServiceClient contains operations for Microsoft Azure File Service.
 | 
			
		||||
type FileServiceClient struct {
 | 
			
		||||
	client Client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// pathForFileShare returns the URL path segment for a File Share resource
 | 
			
		||||
func pathForFileShare(name string) string {
 | 
			
		||||
	return fmt.Sprintf("/%s", name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateShare operation creates a new share under the specified account. If the
 | 
			
		||||
// share with the same name already exists, the operation fails.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
 | 
			
		||||
func (f FileServiceClient) CreateShare(name string) error {
 | 
			
		||||
	resp, err := f.createShare(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusCreated})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateShareIfNotExists creates a new share under the specified account if
 | 
			
		||||
// it does not exist. Returns true if container is newly created or false if
 | 
			
		||||
// container already exists.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dn167008.aspx
 | 
			
		||||
func (f FileServiceClient) CreateShareIfNotExists(name string) (bool, error) {
 | 
			
		||||
	resp, err := f.createShare(name)
 | 
			
		||||
	if resp != nil {
 | 
			
		||||
		defer resp.body.Close()
 | 
			
		||||
		if resp.statusCode == http.StatusCreated || resp.statusCode == http.StatusConflict {
 | 
			
		||||
			return resp.statusCode == http.StatusCreated, nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateShare creates a Azure File Share and returns its response
 | 
			
		||||
func (f FileServiceClient) createShare(name string) (*storageResponse, error) {
 | 
			
		||||
	if err := f.checkForStorageEmulator(); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	uri := f.client.getEndpoint(fileServiceName, pathForFileShare(name), url.Values{"restype": {"share"}})
 | 
			
		||||
	headers := f.client.getStandardHeaders()
 | 
			
		||||
	return f.client.exec("PUT", uri, headers, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteShare operation marks the specified share for deletion. The share
 | 
			
		||||
// and any files contained within it are later deleted during garbage
 | 
			
		||||
// collection.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
 | 
			
		||||
func (f FileServiceClient) DeleteShare(name string) error {
 | 
			
		||||
	resp, err := f.deleteShare(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusAccepted})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteShareIfExists operation marks the specified share for deletion if it
 | 
			
		||||
// exists. The share and any files contained within it are later deleted during
 | 
			
		||||
// garbage collection. Returns true if share existed and deleted with this call,
 | 
			
		||||
// false otherwise.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dn689090.aspx
 | 
			
		||||
func (f FileServiceClient) DeleteShareIfExists(name string) (bool, error) {
 | 
			
		||||
	resp, err := f.deleteShare(name)
 | 
			
		||||
	if resp != nil {
 | 
			
		||||
		defer resp.body.Close()
 | 
			
		||||
		if resp.statusCode == http.StatusAccepted || resp.statusCode == http.StatusNotFound {
 | 
			
		||||
			return resp.statusCode == http.StatusAccepted, nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return false, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// deleteShare makes the call to Delete Share operation endpoint and returns
 | 
			
		||||
// the response
 | 
			
		||||
func (f FileServiceClient) deleteShare(name string) (*storageResponse, error) {
 | 
			
		||||
	if err := f.checkForStorageEmulator(); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	uri := f.client.getEndpoint(fileServiceName, pathForFileShare(name), url.Values{"restype": {"share"}})
 | 
			
		||||
	return f.client.exec("DELETE", uri, f.client.getStandardHeaders(), nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//checkForStorageEmulator determines if the client is setup for use with
 | 
			
		||||
//Azure Storage Emulator, and returns a relevant error
 | 
			
		||||
func (f FileServiceClient) checkForStorageEmulator() error {
 | 
			
		||||
	if f.client.accountName == StorageEmulatorAccountName {
 | 
			
		||||
		return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator")
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										306
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,306 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/xml"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// casing is per Golang's http.Header canonicalizing the header names.
 | 
			
		||||
	approximateMessagesCountHeader  = "X-Ms-Approximate-Messages-Count"
 | 
			
		||||
	userDefinedMetadataHeaderPrefix = "X-Ms-Meta-"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// QueueServiceClient contains operations for Microsoft Azure Queue Storage
 | 
			
		||||
// Service.
 | 
			
		||||
type QueueServiceClient struct {
 | 
			
		||||
	client Client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func pathForQueue(queue string) string         { return fmt.Sprintf("/%s", queue) }
 | 
			
		||||
func pathForQueueMessages(queue string) string { return fmt.Sprintf("/%s/messages", queue) }
 | 
			
		||||
func pathForMessage(queue, name string) string { return fmt.Sprintf("/%s/messages/%s", queue, name) }
 | 
			
		||||
 | 
			
		||||
type putMessageRequest struct {
 | 
			
		||||
	XMLName     xml.Name `xml:"QueueMessage"`
 | 
			
		||||
	MessageText string   `xml:"MessageText"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PutMessageParameters is the set of options can be specified for Put Messsage
 | 
			
		||||
// operation. A zero struct does not use any preferences for the request.
 | 
			
		||||
type PutMessageParameters struct {
 | 
			
		||||
	VisibilityTimeout int
 | 
			
		||||
	MessageTTL        int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p PutMessageParameters) getParameters() url.Values {
 | 
			
		||||
	out := url.Values{}
 | 
			
		||||
	if p.VisibilityTimeout != 0 {
 | 
			
		||||
		out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout))
 | 
			
		||||
	}
 | 
			
		||||
	if p.MessageTTL != 0 {
 | 
			
		||||
		out.Set("messagettl", strconv.Itoa(p.MessageTTL))
 | 
			
		||||
	}
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMessagesParameters is the set of options can be specified for Get
 | 
			
		||||
// Messsages operation. A zero struct does not use any preferences for the
 | 
			
		||||
// request.
 | 
			
		||||
type GetMessagesParameters struct {
 | 
			
		||||
	NumOfMessages     int
 | 
			
		||||
	VisibilityTimeout int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p GetMessagesParameters) getParameters() url.Values {
 | 
			
		||||
	out := url.Values{}
 | 
			
		||||
	if p.NumOfMessages != 0 {
 | 
			
		||||
		out.Set("numofmessages", strconv.Itoa(p.NumOfMessages))
 | 
			
		||||
	}
 | 
			
		||||
	if p.VisibilityTimeout != 0 {
 | 
			
		||||
		out.Set("visibilitytimeout", strconv.Itoa(p.VisibilityTimeout))
 | 
			
		||||
	}
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PeekMessagesParameters is the set of options can be specified for Peek
 | 
			
		||||
// Messsage operation. A zero struct does not use any preferences for the
 | 
			
		||||
// request.
 | 
			
		||||
type PeekMessagesParameters struct {
 | 
			
		||||
	NumOfMessages int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p PeekMessagesParameters) getParameters() url.Values {
 | 
			
		||||
	out := url.Values{"peekonly": {"true"}} // Required for peek operation
 | 
			
		||||
	if p.NumOfMessages != 0 {
 | 
			
		||||
		out.Set("numofmessages", strconv.Itoa(p.NumOfMessages))
 | 
			
		||||
	}
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMessagesResponse represents a response returned from Get Messages
 | 
			
		||||
// operation.
 | 
			
		||||
type GetMessagesResponse struct {
 | 
			
		||||
	XMLName           xml.Name             `xml:"QueueMessagesList"`
 | 
			
		||||
	QueueMessagesList []GetMessageResponse `xml:"QueueMessage"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMessageResponse represents a QueueMessage object returned from Get
 | 
			
		||||
// Messages operation response.
 | 
			
		||||
type GetMessageResponse struct {
 | 
			
		||||
	MessageID       string `xml:"MessageId"`
 | 
			
		||||
	InsertionTime   string `xml:"InsertionTime"`
 | 
			
		||||
	ExpirationTime  string `xml:"ExpirationTime"`
 | 
			
		||||
	PopReceipt      string `xml:"PopReceipt"`
 | 
			
		||||
	TimeNextVisible string `xml:"TimeNextVisible"`
 | 
			
		||||
	DequeueCount    int    `xml:"DequeueCount"`
 | 
			
		||||
	MessageText     string `xml:"MessageText"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PeekMessagesResponse represents a response returned from Get Messages
 | 
			
		||||
// operation.
 | 
			
		||||
type PeekMessagesResponse struct {
 | 
			
		||||
	XMLName           xml.Name              `xml:"QueueMessagesList"`
 | 
			
		||||
	QueueMessagesList []PeekMessageResponse `xml:"QueueMessage"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PeekMessageResponse represents a QueueMessage object returned from Peek
 | 
			
		||||
// Messages operation response.
 | 
			
		||||
type PeekMessageResponse struct {
 | 
			
		||||
	MessageID      string `xml:"MessageId"`
 | 
			
		||||
	InsertionTime  string `xml:"InsertionTime"`
 | 
			
		||||
	ExpirationTime string `xml:"ExpirationTime"`
 | 
			
		||||
	DequeueCount   int    `xml:"DequeueCount"`
 | 
			
		||||
	MessageText    string `xml:"MessageText"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QueueMetadataResponse represents user defined metadata and queue
 | 
			
		||||
// properties on a specific queue.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179384.aspx
 | 
			
		||||
type QueueMetadataResponse struct {
 | 
			
		||||
	ApproximateMessageCount int
 | 
			
		||||
	UserDefinedMetadata     map[string]string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetMetadata operation sets user-defined metadata on the specified queue.
 | 
			
		||||
// Metadata is associated with the queue as name-value pairs.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179348.aspx
 | 
			
		||||
func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
 | 
			
		||||
	headers := c.client.getStandardHeaders()
 | 
			
		||||
	for k, v := range metadata {
 | 
			
		||||
		headers[userDefinedMetadataHeaderPrefix+k] = v
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.exec("PUT", uri, headers, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMetadata operation retrieves user-defined metadata and queue
 | 
			
		||||
// properties on the specified queue. Metadata is associated with
 | 
			
		||||
// the queue as name-values pairs.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179384.aspx
 | 
			
		||||
//
 | 
			
		||||
// Because the way Golang's http client (and http.Header in particular)
 | 
			
		||||
// canonicalize header names, the returned metadata names would always
 | 
			
		||||
// be all lower case.
 | 
			
		||||
func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, error) {
 | 
			
		||||
	qm := QueueMetadataResponse{}
 | 
			
		||||
	qm.UserDefinedMetadata = make(map[string]string)
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": []string{"metadata"}})
 | 
			
		||||
	headers := c.client.getStandardHeaders()
 | 
			
		||||
	resp, err := c.client.exec("GET", uri, headers, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return qm, err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	for k, v := range resp.headers {
 | 
			
		||||
		if len(v) != 1 {
 | 
			
		||||
			return qm, fmt.Errorf("Unexpected number of values (%d) in response header '%s'", len(v), k)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		value := v[0]
 | 
			
		||||
 | 
			
		||||
		if k == approximateMessagesCountHeader {
 | 
			
		||||
			qm.ApproximateMessageCount, err = strconv.Atoi(value)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return qm, fmt.Errorf("Unexpected value in response header '%s': '%s' ", k, value)
 | 
			
		||||
			}
 | 
			
		||||
		} else if strings.HasPrefix(k, userDefinedMetadataHeaderPrefix) {
 | 
			
		||||
			name := strings.TrimPrefix(k, userDefinedMetadataHeaderPrefix)
 | 
			
		||||
			qm.UserDefinedMetadata[strings.ToLower(name)] = value
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return qm, checkRespCode(resp.statusCode, []int{http.StatusOK})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateQueue operation creates a queue under the given account.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179342.aspx
 | 
			
		||||
func (c QueueServiceClient) CreateQueue(name string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{})
 | 
			
		||||
	headers := c.client.getStandardHeaders()
 | 
			
		||||
	resp, err := c.client.exec("PUT", uri, headers, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusCreated})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteQueue operation permanently deletes the specified queue.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179436.aspx
 | 
			
		||||
func (c QueueServiceClient) DeleteQueue(name string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{})
 | 
			
		||||
	resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QueueExists returns true if a queue with given name exists.
 | 
			
		||||
func (c QueueServiceClient) QueueExists(name string) (bool, error) {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueue(name), url.Values{"comp": {"metadata"}})
 | 
			
		||||
	resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if resp != nil && (resp.statusCode == http.StatusOK || resp.statusCode == http.StatusNotFound) {
 | 
			
		||||
		return resp.statusCode == http.StatusOK, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return false, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PutMessage operation adds a new message to the back of the message queue.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179346.aspx
 | 
			
		||||
func (c QueueServiceClient) PutMessage(queue string, message string, params PutMessageParameters) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters())
 | 
			
		||||
	req := putMessageRequest{MessageText: message}
 | 
			
		||||
	body, nn, err := xmlMarshal(req)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	headers := c.client.getStandardHeaders()
 | 
			
		||||
	headers["Content-Length"] = strconv.Itoa(nn)
 | 
			
		||||
	resp, err := c.client.exec("POST", uri, headers, body)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusCreated})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ClearMessages operation deletes all messages from the specified queue.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179454.aspx
 | 
			
		||||
func (c QueueServiceClient) ClearMessages(queue string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), url.Values{})
 | 
			
		||||
	resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetMessages operation retrieves one or more messages from the front of the
 | 
			
		||||
// queue.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179474.aspx
 | 
			
		||||
func (c QueueServiceClient) GetMessages(queue string, params GetMessagesParameters) (GetMessagesResponse, error) {
 | 
			
		||||
	var r GetMessagesResponse
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters())
 | 
			
		||||
	resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return r, err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	err = xmlUnmarshal(resp.body, &r)
 | 
			
		||||
	return r, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// PeekMessages retrieves one or more messages from the front of the queue, but
 | 
			
		||||
// does not alter the visibility of the message.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179472.aspx
 | 
			
		||||
func (c QueueServiceClient) PeekMessages(queue string, params PeekMessagesParameters) (PeekMessagesResponse, error) {
 | 
			
		||||
	var r PeekMessagesResponse
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForQueueMessages(queue), params.getParameters())
 | 
			
		||||
	resp, err := c.client.exec("GET", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return r, err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	err = xmlUnmarshal(resp.body, &r)
 | 
			
		||||
	return r, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteMessage operation deletes the specified message.
 | 
			
		||||
//
 | 
			
		||||
// See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx
 | 
			
		||||
func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(queueServiceName, pathForMessage(queue, messageID), url.Values{
 | 
			
		||||
		"popreceipt": {popReceipt}})
 | 
			
		||||
	resp, err := c.client.exec("DELETE", uri, c.client.getStandardHeaders(), nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
	return checkRespCode(resp.statusCode, []int{http.StatusNoContent})
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										129
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/table.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/table.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,129 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// TableServiceClient contains operations for Microsoft Azure Table Storage
 | 
			
		||||
// Service.
 | 
			
		||||
type TableServiceClient struct {
 | 
			
		||||
	client Client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AzureTable is the typedef of the Azure Table name
 | 
			
		||||
type AzureTable string
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	tablesURIPath = "/Tables"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type createTableRequest struct {
 | 
			
		||||
	TableName string `json:"TableName"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func pathForTable(table AzureTable) string { return fmt.Sprintf("%s", table) }
 | 
			
		||||
 | 
			
		||||
func (c *TableServiceClient) getStandardHeaders() map[string]string {
 | 
			
		||||
	return map[string]string{
 | 
			
		||||
		"x-ms-version":   "2015-02-21",
 | 
			
		||||
		"x-ms-date":      currentTimeRfc1123Formatted(),
 | 
			
		||||
		"Accept":         "application/json;odata=nometadata",
 | 
			
		||||
		"Accept-Charset": "UTF-8",
 | 
			
		||||
		"Content-Type":   "application/json",
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QueryTables returns the tables created in the
 | 
			
		||||
// *TableServiceClient storage account.
 | 
			
		||||
func (c *TableServiceClient) QueryTables() ([]AzureTable, error) {
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{})
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
	headers["Content-Length"] = "0"
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.execTable("GET", uri, headers, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	buf := new(bytes.Buffer)
 | 
			
		||||
	buf.ReadFrom(resp.body)
 | 
			
		||||
 | 
			
		||||
	var respArray queryTablesResponse
 | 
			
		||||
	if err := json.Unmarshal(buf.Bytes(), &respArray); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s := make([]AzureTable, len(respArray.TableName))
 | 
			
		||||
	for i, elem := range respArray.TableName {
 | 
			
		||||
		s[i] = AzureTable(elem.TableName)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return s, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateTable creates the table given the specific
 | 
			
		||||
// name. This function fails if the name is not compliant
 | 
			
		||||
// with the specification or the tables already exists.
 | 
			
		||||
func (c *TableServiceClient) CreateTable(table AzureTable) error {
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{})
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
 | 
			
		||||
	req := createTableRequest{TableName: string(table)}
 | 
			
		||||
	buf := new(bytes.Buffer)
 | 
			
		||||
 | 
			
		||||
	if err := json.NewEncoder(buf).Encode(req); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	headers["Content-Length"] = fmt.Sprintf("%d", buf.Len())
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.execTable("POST", uri, headers, buf)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	if err := checkRespCode(resp.statusCode, []int{http.StatusCreated}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteTable deletes the table given the specific
 | 
			
		||||
// name. This function fails if the table is not present.
 | 
			
		||||
// Be advised: DeleteTable deletes all the entries
 | 
			
		||||
// that may be present.
 | 
			
		||||
func (c *TableServiceClient) DeleteTable(table AzureTable) error {
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{})
 | 
			
		||||
	uri += fmt.Sprintf("('%s')", string(table))
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
 | 
			
		||||
	headers["Content-Length"] = "0"
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.execTable("DELETE", uri, headers, nil)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										351
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/table_entities.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										351
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/table_entities.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,351 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"reflect"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	partitionKeyNode                    = "PartitionKey"
 | 
			
		||||
	rowKeyNode                          = "RowKey"
 | 
			
		||||
	tag                                 = "table"
 | 
			
		||||
	tagIgnore                           = "-"
 | 
			
		||||
	continuationTokenPartitionKeyHeader = "X-Ms-Continuation-Nextpartitionkey"
 | 
			
		||||
	continuationTokenRowHeader          = "X-Ms-Continuation-Nextrowkey"
 | 
			
		||||
	maxTopParameter                     = 1000
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type queryTablesResponse struct {
 | 
			
		||||
	TableName []struct {
 | 
			
		||||
		TableName string `json:"TableName"`
 | 
			
		||||
	} `json:"value"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	tableOperationTypeInsert          = iota
 | 
			
		||||
	tableOperationTypeUpdate          = iota
 | 
			
		||||
	tableOperationTypeMerge           = iota
 | 
			
		||||
	tableOperationTypeInsertOrReplace = iota
 | 
			
		||||
	tableOperationTypeInsertOrMerge   = iota
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type tableOperation int
 | 
			
		||||
 | 
			
		||||
// TableEntity interface specifies
 | 
			
		||||
// the functions needed to support
 | 
			
		||||
// marshaling and unmarshaling into
 | 
			
		||||
// Azure Tables. The struct must only contain
 | 
			
		||||
// simple types because Azure Tables do not
 | 
			
		||||
// support hierarchy.
 | 
			
		||||
type TableEntity interface {
 | 
			
		||||
	PartitionKey() string
 | 
			
		||||
	RowKey() string
 | 
			
		||||
	SetPartitionKey(string) error
 | 
			
		||||
	SetRowKey(string) error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContinuationToken is an opaque (ie not useful to inspect)
 | 
			
		||||
// struct that Get... methods can return if there are more
 | 
			
		||||
// entries to be returned than the ones already
 | 
			
		||||
// returned. Just pass it to the same function to continue
 | 
			
		||||
// receiving the remaining entries.
 | 
			
		||||
type ContinuationToken struct {
 | 
			
		||||
	NextPartitionKey string
 | 
			
		||||
	NextRowKey       string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type getTableEntriesResponse struct {
 | 
			
		||||
	Elements []map[string]interface{} `json:"value"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// QueryTableEntities queries the specified table and returns the unmarshaled
 | 
			
		||||
// entities of type retType.
 | 
			
		||||
// top parameter limits the returned entries up to top. Maximum top
 | 
			
		||||
// allowed by Azure API is 1000. In case there are more than top entries to be
 | 
			
		||||
// returned the function will return a non nil *ContinuationToken. You can call the
 | 
			
		||||
// same function again passing the received ContinuationToken as previousContToken
 | 
			
		||||
// parameter in order to get the following entries. The query parameter
 | 
			
		||||
// is the odata query. To retrieve all the entries pass the empty string.
 | 
			
		||||
// The function returns a pointer to a TableEntity slice, the *ContinuationToken
 | 
			
		||||
// if there are more entries to be returned and an error in case something went
 | 
			
		||||
// wrong.
 | 
			
		||||
//
 | 
			
		||||
// Example:
 | 
			
		||||
// 		entities, cToken, err = tSvc.QueryTableEntities("table", cToken, reflect.TypeOf(entity), 20, "")
 | 
			
		||||
func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousContToken *ContinuationToken, retType reflect.Type, top int, query string) ([]TableEntity, *ContinuationToken, error) {
 | 
			
		||||
	if top > maxTopParameter {
 | 
			
		||||
		return nil, nil, fmt.Errorf("top accepts at maximum %d elements. Requested %d instead", maxTopParameter, top)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, pathForTable(tableName), url.Values{})
 | 
			
		||||
	uri += fmt.Sprintf("?$top=%d", top)
 | 
			
		||||
	if query != "" {
 | 
			
		||||
		uri += fmt.Sprintf("&$filter=%s", url.QueryEscape(query))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if previousContToken != nil {
 | 
			
		||||
		uri += fmt.Sprintf("&NextPartitionKey=%s&NextRowKey=%s", previousContToken.NextPartitionKey, previousContToken.NextRowKey)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
 | 
			
		||||
	headers["Content-Length"] = "0"
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.execTable("GET", uri, headers, nil)
 | 
			
		||||
 | 
			
		||||
	contToken := extractContinuationTokenFromHeaders(resp.headers)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, contToken, err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	if err := checkRespCode(resp.statusCode, []int{http.StatusOK}); err != nil {
 | 
			
		||||
		return nil, contToken, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	retEntries, err := deserializeEntity(retType, resp.body)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, contToken, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return retEntries, contToken, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// InsertEntity inserts an entity in the specified table.
 | 
			
		||||
// The function fails if there is an entity with the same
 | 
			
		||||
// PartitionKey and RowKey in the table.
 | 
			
		||||
func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if sc, err := c.execTable(table, entity, false, "POST"); err != nil {
 | 
			
		||||
		return checkRespCode(sc, []int{http.StatusCreated})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *TableServiceClient) execTable(table AzureTable, entity TableEntity, specifyKeysInURL bool, method string) (int, error) {
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, pathForTable(table), url.Values{})
 | 
			
		||||
	if specifyKeysInURL {
 | 
			
		||||
		uri += fmt.Sprintf("(PartitionKey='%s',RowKey='%s')", url.QueryEscape(entity.PartitionKey()), url.QueryEscape(entity.RowKey()))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
 | 
			
		||||
	var buf bytes.Buffer
 | 
			
		||||
 | 
			
		||||
	if err := injectPartitionAndRowKeys(entity, &buf); err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	headers["Content-Length"] = fmt.Sprintf("%d", buf.Len())
 | 
			
		||||
 | 
			
		||||
	var err error
 | 
			
		||||
	var resp *odataResponse
 | 
			
		||||
 | 
			
		||||
	resp, err = c.client.execTable(method, uri, headers, &buf)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	return resp.statusCode, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateEntity updates the contents of an entity with the
 | 
			
		||||
// one passed as parameter. The function fails if there is no entity
 | 
			
		||||
// with the same PartitionKey and RowKey in the table.
 | 
			
		||||
func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
 | 
			
		||||
		return checkRespCode(sc, []int{http.StatusNoContent})
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MergeEntity merges the contents of an entity with the
 | 
			
		||||
// one passed as parameter.
 | 
			
		||||
// The function fails if there is no entity
 | 
			
		||||
// with the same PartitionKey and RowKey in the table.
 | 
			
		||||
func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
 | 
			
		||||
		return checkRespCode(sc, []int{http.StatusNoContent})
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteEntityWithoutCheck deletes the entity matching by
 | 
			
		||||
// PartitionKey and RowKey. There is no check on IfMatch
 | 
			
		||||
// parameter so the entity is always deleted.
 | 
			
		||||
// The function fails if there is no entity
 | 
			
		||||
// with the same PartitionKey and RowKey in the table.
 | 
			
		||||
func (c *TableServiceClient) DeleteEntityWithoutCheck(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	return c.DeleteEntity(table, entity, "*")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DeleteEntity deletes the entity matching by
 | 
			
		||||
// PartitionKey, RowKey and ifMatch field.
 | 
			
		||||
// The function fails if there is no entity
 | 
			
		||||
// with the same PartitionKey and RowKey in the table or
 | 
			
		||||
// the ifMatch is different.
 | 
			
		||||
func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity, ifMatch string) error {
 | 
			
		||||
	uri := c.client.getEndpoint(tableServiceName, pathForTable(table), url.Values{})
 | 
			
		||||
	uri += fmt.Sprintf("(PartitionKey='%s',RowKey='%s')", url.QueryEscape(entity.PartitionKey()), url.QueryEscape(entity.RowKey()))
 | 
			
		||||
 | 
			
		||||
	headers := c.getStandardHeaders()
 | 
			
		||||
 | 
			
		||||
	headers["Content-Length"] = "0"
 | 
			
		||||
	headers["If-Match"] = ifMatch
 | 
			
		||||
 | 
			
		||||
	resp, err := c.client.execTable("DELETE", uri, headers, nil)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	defer resp.body.Close()
 | 
			
		||||
 | 
			
		||||
	if err := checkRespCode(resp.statusCode, []int{http.StatusNoContent}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// InsertOrReplaceEntity inserts an entity in the specified table
 | 
			
		||||
// or replaced the existing one.
 | 
			
		||||
func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if sc, err := c.execTable(table, entity, true, "PUT"); err != nil {
 | 
			
		||||
		return checkRespCode(sc, []int{http.StatusNoContent})
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// InsertOrMergeEntity inserts an entity in the specified table
 | 
			
		||||
// or merges the existing one.
 | 
			
		||||
func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if sc, err := c.execTable(table, entity, true, "MERGE"); err != nil {
 | 
			
		||||
		return checkRespCode(sc, []int{http.StatusNoContent})
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func injectPartitionAndRowKeys(entity TableEntity, buf *bytes.Buffer) error {
 | 
			
		||||
	if err := json.NewEncoder(buf).Encode(entity); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	dec := make(map[string]interface{})
 | 
			
		||||
	if err := json.NewDecoder(buf).Decode(&dec); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Inject PartitionKey and RowKey
 | 
			
		||||
	dec[partitionKeyNode] = entity.PartitionKey()
 | 
			
		||||
	dec[rowKeyNode] = entity.RowKey()
 | 
			
		||||
 | 
			
		||||
	// Remove tagged fields
 | 
			
		||||
	// The tag is defined in the const section
 | 
			
		||||
	// This is useful to avoid storing the PartitionKey and RowKey twice.
 | 
			
		||||
	numFields := reflect.ValueOf(entity).Elem().NumField()
 | 
			
		||||
	for i := 0; i < numFields; i++ {
 | 
			
		||||
		f := reflect.ValueOf(entity).Elem().Type().Field(i)
 | 
			
		||||
 | 
			
		||||
		if f.Tag.Get(tag) == tagIgnore {
 | 
			
		||||
			// we must look for its JSON name in the dictionary
 | 
			
		||||
			// as the user can rename it using a tag
 | 
			
		||||
			jsonName := f.Name
 | 
			
		||||
			if f.Tag.Get("json") != "" {
 | 
			
		||||
				jsonName = f.Tag.Get("json")
 | 
			
		||||
			}
 | 
			
		||||
			delete(dec, jsonName)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	buf.Reset()
 | 
			
		||||
 | 
			
		||||
	if err := json.NewEncoder(buf).Encode(&dec); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func deserializeEntity(retType reflect.Type, reader io.Reader) ([]TableEntity, error) {
 | 
			
		||||
	buf := new(bytes.Buffer)
 | 
			
		||||
 | 
			
		||||
	var ret getTableEntriesResponse
 | 
			
		||||
	if err := json.NewDecoder(reader).Decode(&ret); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tEntries := make([]TableEntity, len(ret.Elements))
 | 
			
		||||
 | 
			
		||||
	for i, entry := range ret.Elements {
 | 
			
		||||
 | 
			
		||||
		buf.Reset()
 | 
			
		||||
		if err := json.NewEncoder(buf).Encode(entry); err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dec := make(map[string]interface{})
 | 
			
		||||
		if err := json.NewDecoder(buf).Decode(&dec); err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		var pKey, rKey string
 | 
			
		||||
		// strip pk and rk
 | 
			
		||||
		for key, val := range dec {
 | 
			
		||||
			switch key {
 | 
			
		||||
			case partitionKeyNode:
 | 
			
		||||
				pKey = val.(string)
 | 
			
		||||
			case rowKeyNode:
 | 
			
		||||
				rKey = val.(string)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		delete(dec, partitionKeyNode)
 | 
			
		||||
		delete(dec, rowKeyNode)
 | 
			
		||||
 | 
			
		||||
		buf.Reset()
 | 
			
		||||
		if err := json.NewEncoder(buf).Encode(dec); err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Create a empty retType instance
 | 
			
		||||
		tEntries[i] = reflect.New(retType.Elem()).Interface().(TableEntity)
 | 
			
		||||
		// Popolate it with the values
 | 
			
		||||
		if err := json.NewDecoder(buf).Decode(&tEntries[i]); err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Reset PartitionKey and RowKey
 | 
			
		||||
		tEntries[i].SetPartitionKey(pKey)
 | 
			
		||||
		tEntries[i].SetRowKey(rKey)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return tEntries, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func extractContinuationTokenFromHeaders(h http.Header) *ContinuationToken {
 | 
			
		||||
	ct := ContinuationToken{h.Get(continuationTokenPartitionKeyHeader), h.Get(continuationTokenRowHeader)}
 | 
			
		||||
 | 
			
		||||
	if ct.NextPartitionKey != "" && ct.NextRowKey != "" {
 | 
			
		||||
		return &ct
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										85
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/util.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								vendor/github.com/Azure/azure-sdk-for-go/storage/util.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
			
		||||
package storage
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"crypto/hmac"
 | 
			
		||||
	"crypto/sha256"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"encoding/xml"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"reflect"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (c Client) computeHmac256(message string) string {
 | 
			
		||||
	h := hmac.New(sha256.New, c.accountKey)
 | 
			
		||||
	h.Write([]byte(message))
 | 
			
		||||
	return base64.StdEncoding.EncodeToString(h.Sum(nil))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func currentTimeRfc1123Formatted() string {
 | 
			
		||||
	return timeRfc1123Formatted(time.Now().UTC())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func timeRfc1123Formatted(t time.Time) string {
 | 
			
		||||
	return t.Format(http.TimeFormat)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func mergeParams(v1, v2 url.Values) url.Values {
 | 
			
		||||
	out := url.Values{}
 | 
			
		||||
	for k, v := range v1 {
 | 
			
		||||
		out[k] = v
 | 
			
		||||
	}
 | 
			
		||||
	for k, v := range v2 {
 | 
			
		||||
		vals, ok := out[k]
 | 
			
		||||
		if ok {
 | 
			
		||||
			vals = append(vals, v...)
 | 
			
		||||
			out[k] = vals
 | 
			
		||||
		} else {
 | 
			
		||||
			out[k] = v
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return out
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func prepareBlockListRequest(blocks []Block) string {
 | 
			
		||||
	s := `<?xml version="1.0" encoding="utf-8"?><BlockList>`
 | 
			
		||||
	for _, v := range blocks {
 | 
			
		||||
		s += fmt.Sprintf("<%s>%s</%s>", v.Status, v.ID, v.Status)
 | 
			
		||||
	}
 | 
			
		||||
	s += `</BlockList>`
 | 
			
		||||
	return s
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func xmlUnmarshal(body io.Reader, v interface{}) error {
 | 
			
		||||
	data, err := ioutil.ReadAll(body)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return xml.Unmarshal(data, v)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func xmlMarshal(v interface{}) (io.Reader, int, error) {
 | 
			
		||||
	b, err := xml.Marshal(v)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, 0, err
 | 
			
		||||
	}
 | 
			
		||||
	return bytes.NewReader(b), len(b), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func headersFromStruct(v interface{}) map[string]string {
 | 
			
		||||
	headers := make(map[string]string)
 | 
			
		||||
	value := reflect.ValueOf(v)
 | 
			
		||||
	for i := 0; i < value.NumField(); i++ {
 | 
			
		||||
		key := value.Type().Field(i).Tag.Get("header")
 | 
			
		||||
		val := value.Field(i).String()
 | 
			
		||||
		if val != "" {
 | 
			
		||||
			headers[key] = val
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return headers
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								vendor/github.com/rubiojr/go-vhd/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/rubiojr/go-vhd/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2015 Sergio Rubio
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										73
									
								
								vendor/github.com/rubiojr/go-vhd/vhd/util.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								vendor/github.com/rubiojr/go-vhd/vhd/util.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
			
		||||
package vhd
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/binary"
 | 
			
		||||
	"encoding/hex"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"unicode/utf16"
 | 
			
		||||
	"unicode/utf8"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// https://groups.google.com/forum/#!msg/golang-nuts/d0nF_k4dSx4/rPGgfXv6QCoJ
 | 
			
		||||
func uuidgen() string {
 | 
			
		||||
	b := uuidgenBytes()
 | 
			
		||||
	return fmt.Sprintf("%x-%x-%x-%x-%x",
 | 
			
		||||
		b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func fmtField(name, value string) {
 | 
			
		||||
	fmt.Printf("%-25s%s\n", name+":", value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func uuidgenBytes() []byte {
 | 
			
		||||
	f, err := os.Open("/dev/urandom")
 | 
			
		||||
	check(err)
 | 
			
		||||
	b := make([]byte, 16)
 | 
			
		||||
	f.Read(b)
 | 
			
		||||
	return b
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func check(e error) {
 | 
			
		||||
	if e != nil {
 | 
			
		||||
		panic(e)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func hexs(a []byte) string {
 | 
			
		||||
	return "0x" + hex.EncodeToString(a[:])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func uuid(a []byte) string {
 | 
			
		||||
	return fmt.Sprintf("%08x-%04x-%04x-%04x-%04x",
 | 
			
		||||
		a[:4],
 | 
			
		||||
		a[4:6],
 | 
			
		||||
		a[6:8],
 | 
			
		||||
		a[8:10],
 | 
			
		||||
		a[10:16])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func uuidToBytes(uuid string) []byte {
 | 
			
		||||
	s := strings.Replace(uuid, "-", "", -1)
 | 
			
		||||
	h, err := hex.DecodeString(s)
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	return h
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	utf16BytesToString converts UTF-16 encoded bytes, in big or
 | 
			
		||||
 	little endian byte order, to a UTF-8 encoded string.
 | 
			
		||||
 	http://stackoverflow.com/a/15794113
 | 
			
		||||
*/
 | 
			
		||||
func utf16BytesToString(b []byte, o binary.ByteOrder) string {
 | 
			
		||||
	utf := make([]uint16, (len(b)+(2-1))/2)
 | 
			
		||||
	for i := 0; i+(2-1) < len(b); i += 2 {
 | 
			
		||||
		utf[i/2] = o.Uint16(b[i:])
 | 
			
		||||
	}
 | 
			
		||||
	if len(b)/2 < len(utf) {
 | 
			
		||||
		utf[len(utf)-1] = utf8.RuneError
 | 
			
		||||
	}
 | 
			
		||||
	return string(utf16.Decode(utf))
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										480
									
								
								vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										480
									
								
								vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,480 @@
 | 
			
		||||
// Package to work with VHD images
 | 
			
		||||
// See https://technet.microsoft.com/en-us/virtualization/bb676673.aspx
 | 
			
		||||
package vhd
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/binary"
 | 
			
		||||
	"encoding/hex"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"math"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const VHD_COOKIE = "636f6e6563746978"     // conectix
 | 
			
		||||
const VHD_DYN_COOKIE = "6378737061727365" // cxsparse
 | 
			
		||||
const VHD_CREATOR_APP = "676f2d766864"    // go-vhd
 | 
			
		||||
const VHD_CREATOR_HOST_OS = "5769326B"    // Win2k
 | 
			
		||||
const VHD_BLOCK_SIZE = 2 * 1024 * 1024    // 2MB
 | 
			
		||||
const VHD_HEADER_SIZE = 512
 | 
			
		||||
const SECTOR_SIZE = 512
 | 
			
		||||
const FOURK_SECTOR_SIZE = 4096
 | 
			
		||||
const VHD_EXTRA_HEADER_SIZE = 1024
 | 
			
		||||
 | 
			
		||||
// A VDH file
 | 
			
		||||
type VHD struct {
 | 
			
		||||
	Footer      VHDHeader
 | 
			
		||||
	ExtraHeader VHDExtraHeader
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VHD Header
 | 
			
		||||
type VHDHeader struct {
 | 
			
		||||
	Cookie             [8]byte
 | 
			
		||||
	Features           [4]byte
 | 
			
		||||
	FileFormatVersion  [4]byte
 | 
			
		||||
	DataOffset         [8]byte
 | 
			
		||||
	Timestamp          [4]byte
 | 
			
		||||
	CreatorApplication [4]byte
 | 
			
		||||
	CreatorVersion     [4]byte
 | 
			
		||||
	CreatorHostOS      [4]byte
 | 
			
		||||
	OriginalSize       [8]byte
 | 
			
		||||
	CurrentSize        [8]byte
 | 
			
		||||
	DiskGeometry       [4]byte
 | 
			
		||||
	DiskType           [4]byte
 | 
			
		||||
	Checksum           [4]byte
 | 
			
		||||
	UniqueId           [16]byte
 | 
			
		||||
	SavedState         [1]byte
 | 
			
		||||
	Reserved           [427]byte
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VHD extra header, for dynamic and differential disks
 | 
			
		||||
type VHDExtraHeader struct {
 | 
			
		||||
	Cookie              [8]byte
 | 
			
		||||
	DataOffset          [8]byte
 | 
			
		||||
	TableOffset         [8]byte
 | 
			
		||||
	HeaderVersion       [4]byte
 | 
			
		||||
	MaxTableEntries     [4]byte
 | 
			
		||||
	BlockSize           [4]byte
 | 
			
		||||
	Checksum            [4]byte
 | 
			
		||||
	ParentUUID          [16]byte
 | 
			
		||||
	ParentTimestamp     [4]byte
 | 
			
		||||
	Reserved            [4]byte
 | 
			
		||||
	ParentUnicodeName   [512]byte
 | 
			
		||||
	ParentLocatorEntry1 [24]byte
 | 
			
		||||
	ParentLocatorEntry2 [24]byte
 | 
			
		||||
	ParentLocatorEntry3 [24]byte
 | 
			
		||||
	ParentLocatorEntry4 [24]byte
 | 
			
		||||
	ParentLocatorEntry5 [24]byte
 | 
			
		||||
	ParentLocatorEntry6 [24]byte
 | 
			
		||||
	ParentLocatorEntry7 [24]byte
 | 
			
		||||
	ParentLocatorEntry8 [24]byte
 | 
			
		||||
	Reserved2           [256]byte
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Options for the CreateSparseVHD function
 | 
			
		||||
type VHDOptions struct {
 | 
			
		||||
	UUID      string
 | 
			
		||||
	Timestamp int64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  VHDExtraHeader methods
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
func (header *VHDExtraHeader) CookieString() string {
 | 
			
		||||
	return string(header.Cookie[:])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Calculate and add the VHD dynamic/differential header checksum
 | 
			
		||||
func (h *VHDExtraHeader) addChecksum() {
 | 
			
		||||
	buffer := new(bytes.Buffer)
 | 
			
		||||
	binary.Write(buffer, binary.BigEndian, h)
 | 
			
		||||
	checksum := 0
 | 
			
		||||
	bb := buffer.Bytes()
 | 
			
		||||
 | 
			
		||||
	for counter := 0; counter < VHD_EXTRA_HEADER_SIZE; counter++ {
 | 
			
		||||
		checksum += int(bb[counter])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	binary.BigEndian.PutUint32(h.Checksum[:], uint32(^checksum))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * VHDHeader methods
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
func (h *VHDHeader) DiskTypeStr() (dt string) {
 | 
			
		||||
	switch h.DiskType[3] {
 | 
			
		||||
	case 0x00:
 | 
			
		||||
		dt = "None"
 | 
			
		||||
	case 0x01:
 | 
			
		||||
		dt = "Deprecated"
 | 
			
		||||
	case 0x02:
 | 
			
		||||
		dt = "Fixed"
 | 
			
		||||
	case 0x03:
 | 
			
		||||
		dt = "Dynamic"
 | 
			
		||||
	case 0x04:
 | 
			
		||||
		dt = "Differential"
 | 
			
		||||
	case 0x05:
 | 
			
		||||
		dt = "Reserved"
 | 
			
		||||
	case 0x06:
 | 
			
		||||
		dt = "Reserved"
 | 
			
		||||
	default:
 | 
			
		||||
		panic("Invalid disk type detected!")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the timestamp of the header
 | 
			
		||||
func (h *VHDHeader) TimestampTime() time.Time {
 | 
			
		||||
	tstamp := binary.BigEndian.Uint32(h.Timestamp[:])
 | 
			
		||||
	return time.Unix(int64(946684800+tstamp), 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Calculate and add the VHD header checksum
 | 
			
		||||
func (h *VHDHeader) addChecksum() {
 | 
			
		||||
	buffer := new(bytes.Buffer)
 | 
			
		||||
	binary.Write(buffer, binary.BigEndian, h)
 | 
			
		||||
	checksum := 0
 | 
			
		||||
	bb := buffer.Bytes()
 | 
			
		||||
 | 
			
		||||
	for counter := 0; counter < VHD_HEADER_SIZE; counter++ {
 | 
			
		||||
		checksum += int(bb[counter])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	binary.BigEndian.PutUint32(h.Checksum[:], uint32(^checksum))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func CreateFixedHeader(size uint64, options *VHDOptions) VHDHeader {
 | 
			
		||||
	header := VHDHeader{}
 | 
			
		||||
	hexToField(VHD_COOKIE, header.Cookie[:])
 | 
			
		||||
	hexToField("00000002", header.Features[:])
 | 
			
		||||
	hexToField("00010000", header.FileFormatVersion[:])
 | 
			
		||||
	hexToField("ffffffffffffffff", header.DataOffset[:])
 | 
			
		||||
 | 
			
		||||
	// LOL Y2038
 | 
			
		||||
	if options.Timestamp != 0 {
 | 
			
		||||
		binary.BigEndian.PutUint32(header.Timestamp[:], uint32(options.Timestamp))
 | 
			
		||||
	} else {
 | 
			
		||||
		t := uint32(time.Now().Unix() - 946684800)
 | 
			
		||||
		binary.BigEndian.PutUint32(header.Timestamp[:], t)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hexToField(VHD_CREATOR_APP, header.CreatorApplication[:])
 | 
			
		||||
	hexToField(VHD_CREATOR_HOST_OS, header.CreatorHostOS[:])
 | 
			
		||||
	binary.BigEndian.PutUint64(header.OriginalSize[:], size)
 | 
			
		||||
	binary.BigEndian.PutUint64(header.CurrentSize[:], size)
 | 
			
		||||
 | 
			
		||||
	// total sectors = disk size / 512b sector size
 | 
			
		||||
	totalSectors := math.Floor(float64(size / 512))
 | 
			
		||||
	// [C, H, S]
 | 
			
		||||
	geometry := calculateCHS(uint64(totalSectors))
 | 
			
		||||
	binary.BigEndian.PutUint16(header.DiskGeometry[:2], uint16(geometry[0]))
 | 
			
		||||
	header.DiskGeometry[2] = uint8(geometry[1])
 | 
			
		||||
	header.DiskGeometry[3] = uint8(geometry[2])
 | 
			
		||||
 | 
			
		||||
	hexToField("00000002", header.DiskType[:]) // Fixed 0x00000002
 | 
			
		||||
	hexToField("00000000", header.Checksum[:])
 | 
			
		||||
 | 
			
		||||
	if options.UUID != "" {
 | 
			
		||||
		copy(header.UniqueId[:], uuidToBytes(options.UUID))
 | 
			
		||||
	} else {
 | 
			
		||||
		copy(header.UniqueId[:], uuidgenBytes())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	header.addChecksum()
 | 
			
		||||
	return header
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RawToFixed(f *os.File, options *VHDOptions) {
 | 
			
		||||
	info, err := f.Stat()
 | 
			
		||||
	check(err)
 | 
			
		||||
	size := uint64(info.Size())
 | 
			
		||||
	header := CreateFixedHeader(size, options)
 | 
			
		||||
	binary.Write(f, binary.BigEndian, header)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func VHDCreateSparse(size uint64, name string, options VHDOptions) VHD {
 | 
			
		||||
	header := VHDHeader{}
 | 
			
		||||
	hexToField(VHD_COOKIE, header.Cookie[:])
 | 
			
		||||
	hexToField("00000002", header.Features[:])
 | 
			
		||||
	hexToField("00010000", header.FileFormatVersion[:])
 | 
			
		||||
	hexToField("0000000000000200", header.DataOffset[:])
 | 
			
		||||
 | 
			
		||||
	// LOL Y2038
 | 
			
		||||
	if options.Timestamp != 0 {
 | 
			
		||||
		binary.BigEndian.PutUint32(header.Timestamp[:], uint32(options.Timestamp))
 | 
			
		||||
	} else {
 | 
			
		||||
		t := uint32(time.Now().Unix() - 946684800)
 | 
			
		||||
		binary.BigEndian.PutUint32(header.Timestamp[:], t)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hexToField(VHD_CREATOR_APP, header.CreatorApplication[:])
 | 
			
		||||
	hexToField(VHD_CREATOR_HOST_OS, header.CreatorHostOS[:])
 | 
			
		||||
	binary.BigEndian.PutUint64(header.OriginalSize[:], size)
 | 
			
		||||
	binary.BigEndian.PutUint64(header.CurrentSize[:], size)
 | 
			
		||||
 | 
			
		||||
	// total sectors = disk size / 512b sector size
 | 
			
		||||
	totalSectors := math.Floor(float64(size / 512))
 | 
			
		||||
	// [C, H, S]
 | 
			
		||||
	geometry := calculateCHS(uint64(totalSectors))
 | 
			
		||||
	binary.BigEndian.PutUint16(header.DiskGeometry[:2], uint16(geometry[0]))
 | 
			
		||||
	header.DiskGeometry[2] = uint8(geometry[1])
 | 
			
		||||
	header.DiskGeometry[3] = uint8(geometry[2])
 | 
			
		||||
 | 
			
		||||
	hexToField("00000003", header.DiskType[:]) // Sparse 0x00000003
 | 
			
		||||
	hexToField("00000000", header.Checksum[:])
 | 
			
		||||
 | 
			
		||||
	if options.UUID != "" {
 | 
			
		||||
		copy(header.UniqueId[:], uuidToBytes(options.UUID))
 | 
			
		||||
	} else {
 | 
			
		||||
		copy(header.UniqueId[:], uuidgenBytes())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	header.addChecksum()
 | 
			
		||||
 | 
			
		||||
	// Fill the sparse header
 | 
			
		||||
	header2 := VHDExtraHeader{}
 | 
			
		||||
	hexToField(VHD_DYN_COOKIE, header2.Cookie[:])
 | 
			
		||||
	hexToField("ffffffffffffffff", header2.DataOffset[:])
 | 
			
		||||
	// header size + sparse header size
 | 
			
		||||
	binary.BigEndian.PutUint64(header2.TableOffset[:], uint64(VHD_EXTRA_HEADER_SIZE+VHD_HEADER_SIZE))
 | 
			
		||||
	hexToField("00010000", header2.HeaderVersion[:])
 | 
			
		||||
 | 
			
		||||
	maxTableSize := uint32(size / (VHD_BLOCK_SIZE))
 | 
			
		||||
	binary.BigEndian.PutUint32(header2.MaxTableEntries[:], maxTableSize)
 | 
			
		||||
 | 
			
		||||
	binary.BigEndian.PutUint32(header2.BlockSize[:], VHD_BLOCK_SIZE)
 | 
			
		||||
	binary.BigEndian.PutUint32(header2.ParentTimestamp[:], uint32(0))
 | 
			
		||||
	header2.addChecksum()
 | 
			
		||||
 | 
			
		||||
	f, err := os.Create(name)
 | 
			
		||||
	check(err)
 | 
			
		||||
	defer f.Close()
 | 
			
		||||
 | 
			
		||||
	binary.Write(f, binary.BigEndian, header)
 | 
			
		||||
	binary.Write(f, binary.BigEndian, header2)
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
		Write BAT entries
 | 
			
		||||
		The BAT is always extended to a sector (4K) boundary
 | 
			
		||||
		1536 = 512 + 1024 (the VHD Header + VHD Sparse header size)
 | 
			
		||||
	*/
 | 
			
		||||
	for count := uint32(0); count < (FOURK_SECTOR_SIZE - 1536); count += 1 {
 | 
			
		||||
		f.Write([]byte{0xff})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Windows creates 8K VHDs by default */
 | 
			
		||||
	for i := 0; i < (FOURK_SECTOR_SIZE - VHD_HEADER_SIZE); i += 1 {
 | 
			
		||||
		f.Write([]byte{0x0})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	binary.Write(f, binary.BigEndian, header)
 | 
			
		||||
 | 
			
		||||
	return VHD{
 | 
			
		||||
		Footer:      header,
 | 
			
		||||
		ExtraHeader: header2,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * VHD
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
func FromFile(f *os.File) (vhd VHD) {
 | 
			
		||||
	vhd = VHD{}
 | 
			
		||||
	vhd.Footer = readVHDFooter(f)
 | 
			
		||||
	vhd.ExtraHeader = readVHDExtraHeader(f)
 | 
			
		||||
 | 
			
		||||
	return vhd
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (vhd *VHD) PrintInfo() {
 | 
			
		||||
	fmt.Println("\nVHD footer")
 | 
			
		||||
	fmt.Println("==========")
 | 
			
		||||
	vhd.PrintFooter()
 | 
			
		||||
 | 
			
		||||
	if vhd.Footer.DiskType[3] == 0x3 || vhd.Footer.DiskType[3] == 0x04 {
 | 
			
		||||
		fmt.Println("\nVHD sparse/differential header")
 | 
			
		||||
		fmt.Println("===============================")
 | 
			
		||||
		vhd.PrintExtraHeader()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (vhd *VHD) PrintExtraHeader() {
 | 
			
		||||
	header := vhd.ExtraHeader
 | 
			
		||||
 | 
			
		||||
	fmtField("Cookie", fmt.Sprintf("%s (%s)",
 | 
			
		||||
		hexs(header.Cookie[:]), header.CookieString()))
 | 
			
		||||
	fmtField("Data offset", hexs(header.DataOffset[:]))
 | 
			
		||||
	fmtField("Table offset", hexs(header.TableOffset[:]))
 | 
			
		||||
	fmtField("Header version", hexs(header.HeaderVersion[:]))
 | 
			
		||||
	fmtField("Max table entries", hexs(header.MaxTableEntries[:]))
 | 
			
		||||
	fmtField("Block size", hexs(header.BlockSize[:]))
 | 
			
		||||
	fmtField("Checksum", hexs(header.Checksum[:]))
 | 
			
		||||
	fmtField("Parent UUID", uuid(header.ParentUUID[:]))
 | 
			
		||||
 | 
			
		||||
	// Seconds since January 1, 1970 12:00:00 AM in UTC/GMT.
 | 
			
		||||
	// 946684800 = January 1, 2000 12:00:00 AM in UTC/GMT.
 | 
			
		||||
	tstamp := binary.BigEndian.Uint32(header.ParentTimestamp[:])
 | 
			
		||||
	t := time.Unix(int64(946684800+tstamp), 0)
 | 
			
		||||
	fmtField("Parent timestamp", fmt.Sprintf("%s", t))
 | 
			
		||||
 | 
			
		||||
	fmtField("Reserved", hexs(header.Reserved[:]))
 | 
			
		||||
	parentName := utf16BytesToString(header.ParentUnicodeName[:],
 | 
			
		||||
		binary.BigEndian)
 | 
			
		||||
	fmtField("Parent Name", parentName)
 | 
			
		||||
	// Parent locator entries ignored since it's a dynamic disk
 | 
			
		||||
	sum := 0
 | 
			
		||||
	for _, b := range header.Reserved2 {
 | 
			
		||||
		sum += int(b)
 | 
			
		||||
	}
 | 
			
		||||
	fmtField("Reserved2", strconv.Itoa(sum))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (vhd *VHD) PrintFooter() {
 | 
			
		||||
	header := vhd.Footer
 | 
			
		||||
 | 
			
		||||
	//fmtField("Cookie", string(header.Cookie[:]))
 | 
			
		||||
	fmtField("Cookie", fmt.Sprintf("%s (%s)",
 | 
			
		||||
		hexs(header.Cookie[:]), string(header.Cookie[:])))
 | 
			
		||||
	fmtField("Features", hexs(header.Features[:]))
 | 
			
		||||
	fmtField("File format version", hexs(header.FileFormatVersion[:]))
 | 
			
		||||
 | 
			
		||||
	dataOffset := binary.BigEndian.Uint64(header.DataOffset[:])
 | 
			
		||||
	fmtField("Data offset",
 | 
			
		||||
		fmt.Sprintf("%s (%d bytes)", hexs(header.DataOffset[:]), dataOffset))
 | 
			
		||||
 | 
			
		||||
	//// Seconds since January 1, 1970 12:00:00 AM in UTC/GMT.
 | 
			
		||||
	//// 946684800 = January 1, 2000 12:00:00 AM in UTC/GMT.
 | 
			
		||||
	t := time.Unix(int64(946684800+binary.BigEndian.Uint32(header.Timestamp[:])), 0)
 | 
			
		||||
	fmtField("Timestamp", fmt.Sprintf("%s", t))
 | 
			
		||||
 | 
			
		||||
	fmtField("Creator application", string(header.CreatorApplication[:]))
 | 
			
		||||
	fmtField("Creator version", hexs(header.CreatorVersion[:]))
 | 
			
		||||
	fmtField("Creator OS", string(header.CreatorHostOS[:]))
 | 
			
		||||
 | 
			
		||||
	originalSize := binary.BigEndian.Uint64(header.OriginalSize[:])
 | 
			
		||||
	fmtField("Original size",
 | 
			
		||||
		fmt.Sprintf("%s ( %d bytes )", hexs(header.OriginalSize[:]), originalSize))
 | 
			
		||||
 | 
			
		||||
	currentSize := binary.BigEndian.Uint64(header.OriginalSize[:])
 | 
			
		||||
	fmtField("Current size",
 | 
			
		||||
		fmt.Sprintf("%s ( %d bytes )", hexs(header.CurrentSize[:]), currentSize))
 | 
			
		||||
 | 
			
		||||
	cilinders := int64(binary.BigEndian.Uint16(header.DiskGeometry[:2]))
 | 
			
		||||
	heads := int64(header.DiskGeometry[2])
 | 
			
		||||
	sectors := int64(header.DiskGeometry[3])
 | 
			
		||||
	dsize := cilinders * heads * sectors * 512
 | 
			
		||||
	fmtField("Disk geometry",
 | 
			
		||||
		fmt.Sprintf("%s (c: %d, h: %d, s: %d) (%d bytes)",
 | 
			
		||||
			hexs(header.DiskGeometry[:]),
 | 
			
		||||
			cilinders,
 | 
			
		||||
			heads,
 | 
			
		||||
			sectors,
 | 
			
		||||
			dsize))
 | 
			
		||||
 | 
			
		||||
	fmtField("Disk type",
 | 
			
		||||
		fmt.Sprintf("%s (%s)", hexs(header.DiskType[:]), header.DiskTypeStr()))
 | 
			
		||||
 | 
			
		||||
	fmtField("Checksum", hexs(header.Checksum[:]))
 | 
			
		||||
	fmtField("UUID", uuid(header.UniqueId[:]))
 | 
			
		||||
	fmtField("Saved state", fmt.Sprintf("%d", header.SavedState[0]))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
	Utility functions
 | 
			
		||||
*/
 | 
			
		||||
func calculateCHS(ts uint64) []uint {
 | 
			
		||||
	var sectorsPerTrack,
 | 
			
		||||
		heads,
 | 
			
		||||
		cylinderTimesHeads,
 | 
			
		||||
		cylinders float64
 | 
			
		||||
	totalSectors := float64(ts)
 | 
			
		||||
 | 
			
		||||
	ret := make([]uint, 3)
 | 
			
		||||
 | 
			
		||||
	if totalSectors > 65535*16*255 {
 | 
			
		||||
		totalSectors = 65535 * 16 * 255
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if totalSectors >= 65535*16*63 {
 | 
			
		||||
		sectorsPerTrack = 255
 | 
			
		||||
		heads = 16
 | 
			
		||||
		cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
 | 
			
		||||
	} else {
 | 
			
		||||
		sectorsPerTrack = 17
 | 
			
		||||
		cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
 | 
			
		||||
		heads = math.Floor((cylinderTimesHeads + 1023) / 1024)
 | 
			
		||||
		if heads < 4 {
 | 
			
		||||
			heads = 4
 | 
			
		||||
		}
 | 
			
		||||
		if (cylinderTimesHeads >= (heads * 1024)) || heads > 16 {
 | 
			
		||||
			sectorsPerTrack = 31
 | 
			
		||||
			heads = 16
 | 
			
		||||
			cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
 | 
			
		||||
		}
 | 
			
		||||
		if cylinderTimesHeads >= (heads * 1024) {
 | 
			
		||||
			sectorsPerTrack = 63
 | 
			
		||||
			heads = 16
 | 
			
		||||
			cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cylinders = cylinderTimesHeads / heads
 | 
			
		||||
 | 
			
		||||
	// This will floor the values
 | 
			
		||||
	ret[0] = uint(cylinders)
 | 
			
		||||
	ret[1] = uint(heads)
 | 
			
		||||
	ret[2] = uint(sectorsPerTrack)
 | 
			
		||||
 | 
			
		||||
	return ret
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func hexToField(hexs string, field []byte) {
 | 
			
		||||
	h, err := hex.DecodeString(hexs)
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	copy(field, h)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Return the number of blocks in the disk, diskSize in bytes
 | 
			
		||||
func getMaxTableEntries(diskSize uint64) uint64 {
 | 
			
		||||
	return diskSize * (2 * 1024 * 1024) // block size is 2M
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func readVHDExtraHeader(f *os.File) (header VHDExtraHeader) {
 | 
			
		||||
	buff := make([]byte, 1024)
 | 
			
		||||
	_, err := f.ReadAt(buff, 512)
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
 | 
			
		||||
 | 
			
		||||
	return header
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func readVHDFooter(f *os.File) (header VHDHeader) {
 | 
			
		||||
	info, err := f.Stat()
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	buff := make([]byte, 512)
 | 
			
		||||
	_, err = f.ReadAt(buff, info.Size()-512)
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
 | 
			
		||||
 | 
			
		||||
	return header
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func readVHDHeader(f *os.File) (header VHDHeader) {
 | 
			
		||||
	buff := make([]byte, 512)
 | 
			
		||||
	_, err := f.ReadAt(buff, 0)
 | 
			
		||||
	check(err)
 | 
			
		||||
 | 
			
		||||
	binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
 | 
			
		||||
 | 
			
		||||
	return header
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user