mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Upgrade go-autorest to 9.1.0
This commit is contained in:
		
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/url"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  This file is largely based on rjw57/oauth2device's code, with the follow differences:
 | 
			
		||||
   * scope -> resource, and only allow a single one
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/msi.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/msi.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,5 +2,19 @@
 | 
			
		||||
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
// msiPath is the path to the MSI Extension settings file (to discover the endpoint)
 | 
			
		||||
var msiPath = "/var/lib/waagent/ManagedIdentity-Settings"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,6 +2,20 @@
 | 
			
		||||
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/persist.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/persist.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/token.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/adal/token.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package adal
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"crypto/rand"
 | 
			
		||||
	"crypto/rsa"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/authorization.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/authorization.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/autorest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/autorest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -57,6 +57,20 @@ generated clients, see the Client described below.
 | 
			
		||||
*/
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"time"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/BUILD
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,6 +6,7 @@ go_library(
 | 
			
		||||
        "async.go",
 | 
			
		||||
        "azure.go",
 | 
			
		||||
        "environments.go",
 | 
			
		||||
        "rp.go",
 | 
			
		||||
    ],
 | 
			
		||||
    importpath = "github.com/Azure/go-autorest/autorest/azure",
 | 
			
		||||
    visibility = ["//visibility:public"],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/async.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/async.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -5,6 +5,20 @@ See the included examples for more detail.
 | 
			
		||||
*/
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
@@ -165,7 +179,13 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator {
 | 
			
		||||
				if decodeErr != nil {
 | 
			
		||||
					return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr)
 | 
			
		||||
				} else if e.ServiceError == nil {
 | 
			
		||||
					e.ServiceError = &ServiceError{Code: "Unknown", Message: "Unknown service error"}
 | 
			
		||||
					// Check if error is unwrapped ServiceError
 | 
			
		||||
					if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil || e.ServiceError.Message == "" {
 | 
			
		||||
						e.ServiceError = &ServiceError{
 | 
			
		||||
							Code:    "Unknown",
 | 
			
		||||
							Message: "Unknown service error",
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				e.RequestID = ExtractRequestID(resp)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/environments.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/environments.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										188
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,188 @@
 | 
			
		||||
package azure
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/Azure/go-autorest/autorest"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// DoRetryWithRegistration tries to register the resource provider in case it is unregistered.
 | 
			
		||||
// It also handles request retries
 | 
			
		||||
func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator {
 | 
			
		||||
	return func(s autorest.Sender) autorest.Sender {
 | 
			
		||||
		return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) {
 | 
			
		||||
			rr := autorest.NewRetriableRequest(r)
 | 
			
		||||
			for currentAttempt := 0; currentAttempt < client.RetryAttempts; currentAttempt++ {
 | 
			
		||||
				err = rr.Prepare()
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return resp, err
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				resp, err = autorest.SendWithSender(s, rr.Request(),
 | 
			
		||||
					autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
 | 
			
		||||
				)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return resp, err
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if resp.StatusCode != http.StatusConflict {
 | 
			
		||||
					return resp, err
 | 
			
		||||
				}
 | 
			
		||||
				var re RequestError
 | 
			
		||||
				err = autorest.Respond(
 | 
			
		||||
					resp,
 | 
			
		||||
					autorest.ByUnmarshallingJSON(&re),
 | 
			
		||||
				)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return resp, err
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if re.ServiceError != nil && re.ServiceError.Code == "MissingSubscriptionRegistration" {
 | 
			
		||||
					err = register(client, r, re)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						return resp, fmt.Errorf("failed auto registering Resource Provider: %s", err)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return resp, errors.New("failed request and resource provider registration")
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getProvider(re RequestError) (string, error) {
 | 
			
		||||
	if re.ServiceError != nil {
 | 
			
		||||
		if re.ServiceError.Details != nil && len(*re.ServiceError.Details) > 0 {
 | 
			
		||||
			detail := (*re.ServiceError.Details)[0].(map[string]interface{})
 | 
			
		||||
			return detail["target"].(string), nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return "", errors.New("provider was not found in the response")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func register(client autorest.Client, originalReq *http.Request, re RequestError) error {
 | 
			
		||||
	subID := getSubscription(originalReq.URL.Path)
 | 
			
		||||
	if subID == "" {
 | 
			
		||||
		return errors.New("missing parameter subscriptionID to register resource provider")
 | 
			
		||||
	}
 | 
			
		||||
	providerName, err := getProvider(re)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("missing parameter provider to register resource provider: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
	newURL := url.URL{
 | 
			
		||||
		Scheme: originalReq.URL.Scheme,
 | 
			
		||||
		Host:   originalReq.URL.Host,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// taken from the resources SDK
 | 
			
		||||
	// with almost identical code, this sections are easier to mantain
 | 
			
		||||
	// It is also not a good idea to import the SDK here
 | 
			
		||||
	// https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L252
 | 
			
		||||
	pathParameters := map[string]interface{}{
 | 
			
		||||
		"resourceProviderNamespace": autorest.Encode("path", providerName),
 | 
			
		||||
		"subscriptionId":            autorest.Encode("path", subID),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const APIVersion = "2016-09-01"
 | 
			
		||||
	queryParameters := map[string]interface{}{
 | 
			
		||||
		"api-version": APIVersion,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	preparer := autorest.CreatePreparer(
 | 
			
		||||
		autorest.AsPost(),
 | 
			
		||||
		autorest.WithBaseURL(newURL.String()),
 | 
			
		||||
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters),
 | 
			
		||||
		autorest.WithQueryParameters(queryParameters),
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	req, err := preparer.Prepare(&http.Request{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	req.Cancel = originalReq.Cancel
 | 
			
		||||
 | 
			
		||||
	resp, err := autorest.SendWithSender(client, req,
 | 
			
		||||
		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
 | 
			
		||||
	)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	type Provider struct {
 | 
			
		||||
		RegistrationState *string `json:"registrationState,omitempty"`
 | 
			
		||||
	}
 | 
			
		||||
	var provider Provider
 | 
			
		||||
 | 
			
		||||
	err = autorest.Respond(
 | 
			
		||||
		resp,
 | 
			
		||||
		WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
		autorest.ByUnmarshallingJSON(&provider),
 | 
			
		||||
		autorest.ByClosing(),
 | 
			
		||||
	)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// poll for registered provisioning state
 | 
			
		||||
	now := time.Now()
 | 
			
		||||
	for err == nil && time.Since(now) < client.PollingDuration {
 | 
			
		||||
		// taken from the resources SDK
 | 
			
		||||
		// https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45
 | 
			
		||||
		preparer := autorest.CreatePreparer(
 | 
			
		||||
			autorest.AsGet(),
 | 
			
		||||
			autorest.WithBaseURL(newURL.String()),
 | 
			
		||||
			autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters),
 | 
			
		||||
			autorest.WithQueryParameters(queryParameters),
 | 
			
		||||
		)
 | 
			
		||||
		req, err = preparer.Prepare(&http.Request{})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		req.Cancel = originalReq.Cancel
 | 
			
		||||
 | 
			
		||||
		resp, err := autorest.SendWithSender(client.Sender, req,
 | 
			
		||||
			autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
 | 
			
		||||
		)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		err = autorest.Respond(
 | 
			
		||||
			resp,
 | 
			
		||||
			WithErrorUnlessStatusCode(http.StatusOK),
 | 
			
		||||
			autorest.ByUnmarshallingJSON(&provider),
 | 
			
		||||
			autorest.ByClosing(),
 | 
			
		||||
		)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if provider.RegistrationState != nil &&
 | 
			
		||||
			*provider.RegistrationState == "Registered" {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		delayed := autorest.DelayWithRetryAfter(resp, originalReq.Cancel)
 | 
			
		||||
		if !delayed {
 | 
			
		||||
			autorest.DelayForBackoff(client.PollingDelay, 0, originalReq.Cancel)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if !(time.Since(now) < client.PollingDuration) {
 | 
			
		||||
		return errors.New("polling for resource provider registration has exceeded the polling duration")
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getSubscription(path string) string {
 | 
			
		||||
	parts := strings.Split(path, "/")
 | 
			
		||||
	for i, v := range parts {
 | 
			
		||||
		if v == "subscriptions" && (i+1) < len(parts) {
 | 
			
		||||
			return parts[i+1]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/github.com/Azure/go-autorest/autorest/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/Azure/go-autorest/autorest/client.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
@@ -33,7 +47,8 @@ var (
 | 
			
		||||
		Version(),
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	statusCodesForRetry = []int{
 | 
			
		||||
	// StatusCodesForRetry are a defined group of status code for which the client will retry
 | 
			
		||||
	StatusCodesForRetry = []int{
 | 
			
		||||
		http.StatusRequestTimeout,      // 408
 | 
			
		||||
		http.StatusTooManyRequests,     // 429
 | 
			
		||||
		http.StatusInternalServerError, // 500
 | 
			
		||||
@@ -187,8 +202,7 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := SendWithSender(c.sender(), r,
 | 
			
		||||
		DoRetryForStatusCodes(c.RetryAttempts, c.RetryDuration, statusCodesForRetry...))
 | 
			
		||||
	resp, err := SendWithSender(c.sender(), r)
 | 
			
		||||
	Respond(resp,
 | 
			
		||||
		c.ByInspecting())
 | 
			
		||||
	return resp, err
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/date.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/date.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -5,6 +5,20 @@ time.Time types. And both convert to time.Time through a ToTime method.
 | 
			
		||||
*/
 | 
			
		||||
package date
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"time"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/time.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package date
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"time"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package date
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"time"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package date
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/binary"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/utility.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/date/utility.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package date
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/error.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/error.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"net/http"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/preparer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/preparer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/responder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/responder.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"io"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,17 +1,31 @@
 | 
			
		||||
// +build !go1.8
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RetriableRequest provides facilities for retrying an HTTP request.
 | 
			
		||||
type RetriableRequest struct {
 | 
			
		||||
	req   *http.Request
 | 
			
		||||
	br    *bytes.Reader
 | 
			
		||||
	reset bool
 | 
			
		||||
	req *http.Request
 | 
			
		||||
	br  *bytes.Reader
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Prepare signals that the request is about to be sent.
 | 
			
		||||
@@ -19,21 +33,17 @@ func (rr *RetriableRequest) Prepare() (err error) {
 | 
			
		||||
	// preserve the request body; this is to support retry logic as
 | 
			
		||||
	// the underlying transport will always close the reqeust body
 | 
			
		||||
	if rr.req.Body != nil {
 | 
			
		||||
		if rr.reset {
 | 
			
		||||
			if rr.br != nil {
 | 
			
		||||
				_, err = rr.br.Seek(0, 0 /*io.SeekStart*/)
 | 
			
		||||
			}
 | 
			
		||||
			rr.reset = false
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		if rr.br != nil {
 | 
			
		||||
			_, err = rr.br.Seek(0, 0 /*io.SeekStart*/)
 | 
			
		||||
			rr.req.Body = ioutil.NopCloser(rr.br)
 | 
			
		||||
		}
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		if rr.br == nil {
 | 
			
		||||
			// fall back to making a copy (only do this once)
 | 
			
		||||
			err = rr.prepareFromByteReader()
 | 
			
		||||
		}
 | 
			
		||||
		// indicates that the request body needs to be reset
 | 
			
		||||
		rr.reset = true
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,19 +1,33 @@
 | 
			
		||||
// +build go1.8
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// RetriableRequest provides facilities for retrying an HTTP request.
 | 
			
		||||
type RetriableRequest struct {
 | 
			
		||||
	req   *http.Request
 | 
			
		||||
	rc    io.ReadCloser
 | 
			
		||||
	br    *bytes.Reader
 | 
			
		||||
	reset bool
 | 
			
		||||
	req *http.Request
 | 
			
		||||
	rc  io.ReadCloser
 | 
			
		||||
	br  *bytes.Reader
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Prepare signals that the request is about to be sent.
 | 
			
		||||
@@ -21,16 +35,14 @@ func (rr *RetriableRequest) Prepare() (err error) {
 | 
			
		||||
	// preserve the request body; this is to support retry logic as
 | 
			
		||||
	// the underlying transport will always close the reqeust body
 | 
			
		||||
	if rr.req.Body != nil {
 | 
			
		||||
		if rr.reset {
 | 
			
		||||
			if rr.rc != nil {
 | 
			
		||||
				rr.req.Body = rr.rc
 | 
			
		||||
			} else if rr.br != nil {
 | 
			
		||||
				_, err = rr.br.Seek(0, io.SeekStart)
 | 
			
		||||
			}
 | 
			
		||||
			rr.reset = false
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return err
 | 
			
		||||
			}
 | 
			
		||||
		if rr.rc != nil {
 | 
			
		||||
			rr.req.Body = rr.rc
 | 
			
		||||
		} else if rr.br != nil {
 | 
			
		||||
			_, err = rr.br.Seek(0, io.SeekStart)
 | 
			
		||||
			rr.req.Body = ioutil.NopCloser(rr.br)
 | 
			
		||||
		}
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		if rr.req.GetBody != nil {
 | 
			
		||||
			// this will allow us to preserve the body without having to
 | 
			
		||||
@@ -43,8 +55,6 @@ func (rr *RetriableRequest) Prepare() (err error) {
 | 
			
		||||
			// fall back to making a copy (only do this once)
 | 
			
		||||
			err = rr.prepareFromByteReader()
 | 
			
		||||
		}
 | 
			
		||||
		// indicates that the request body needs to be reset
 | 
			
		||||
		rr.reset = true
 | 
			
		||||
	}
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/sender.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/sender.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"log"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/to/convert.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/to/convert.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,6 +3,20 @@ Package to provides helpers to ease working with pointer values of marshalled st
 | 
			
		||||
*/
 | 
			
		||||
package to
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
// String returns a string value for the passed string pointer. It returns the empty string if the
 | 
			
		||||
// pointer is nil.
 | 
			
		||||
func String(s *string) string {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/utility.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/utility.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								vendor/github.com/Azure/go-autorest/autorest/validation/validation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/Azure/go-autorest/autorest/validation/validation.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,6 +3,20 @@ Package validation provides methods for validating parameter value using reflect
 | 
			
		||||
*/
 | 
			
		||||
package validation
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"reflect"
 | 
			
		||||
@@ -91,15 +105,12 @@ func validateStruct(x reflect.Value, v Constraint, name ...string) error {
 | 
			
		||||
		return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.Target))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := Validate([]Validation{
 | 
			
		||||
	return Validate([]Validation{
 | 
			
		||||
		{
 | 
			
		||||
			TargetValue: getInterfaceValue(f),
 | 
			
		||||
			Constraints: []Constraint{v},
 | 
			
		||||
		},
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func validatePtr(x reflect.Value, v Constraint) error {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/Azure/go-autorest/autorest/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,5 +1,19 @@
 | 
			
		||||
package autorest
 | 
			
		||||
 | 
			
		||||
// Copyright 2017 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.
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user