diff --git a/services/imds/2019-02-01/imds/CHANGELOG.md b/services/imds/2019-02-01/imds/CHANGELOG.md new file mode 100644 index 000000000000..41b1d7a58b00 --- /dev/null +++ b/services/imds/2019-02-01/imds/CHANGELOG.md @@ -0,0 +1,5 @@ +Generated from https://github.com/Azure/azure-rest-api-specs/tree/838ba7c30392d43fffbd685fa84c2f1b1629272e/specification/imds/data-plane/readme.md tag: `package-2019-02-01` + +Code generator + + diff --git a/services/imds/2019-02-01/imds/attested.go b/services/imds/2019-02-01/imds/attested.go new file mode 100644 index 000000000000..546ae02f48a8 --- /dev/null +++ b/services/imds/2019-02-01/imds/attested.go @@ -0,0 +1,115 @@ +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AttestedClient is the the Azure Instance Metadata Client +type AttestedClient struct { + BaseClient +} + +// NewAttestedClient creates an instance of the AttestedClient client. +func NewAttestedClient() AttestedClient { + return NewAttestedClientWithBaseURI(DefaultBaseURI) +} + +// NewAttestedClientWithBaseURI creates an instance of the AttestedClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAttestedClientWithBaseURI(baseURI string) AttestedClient { + return AttestedClient{NewWithBaseURI(baseURI)} +} + +// GetDocument get Attested Data for the Virtual Machine. +// Parameters: +// nonce - this is a string of up to 32 random alphanumeric characters. +func (client AttestedClient) GetDocument(ctx context.Context, nonce string) (result AttestedData, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttestedClient.GetDocument") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDocumentPreparer(ctx, nonce) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.AttestedClient", "GetDocument", nil, "Failure preparing request") + return + } + + resp, err := client.GetDocumentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "imds.AttestedClient", "GetDocument", resp, "Failure sending request") + return + } + + result, err = client.GetDocumentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.AttestedClient", "GetDocument", resp, "Failure responding to request") + return + } + + return +} + +// GetDocumentPreparer prepares the GetDocument request. +func (client AttestedClient) GetDocumentPreparer(ctx context.Context, nonce string) (*http.Request, error) { + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(nonce) > 0 { + queryParameters["nonce"] = autorest.Encode("query", nonce) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/attested/document"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Metadata", "true")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDocumentSender sends the GetDocument request. The method will close the +// http.Response Body if it receives an error. +func (client AttestedClient) GetDocumentSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDocumentResponder handles the response to the GetDocument request. The method always +// closes the http.Response Body. +func (client AttestedClient) GetDocumentResponder(resp *http.Response) (result AttestedData, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/imds/2019-02-01/imds/client.go b/services/imds/2019-02-01/imds/client.go new file mode 100644 index 000000000000..97d3523dd5ea --- /dev/null +++ b/services/imds/2019-02-01/imds/client.go @@ -0,0 +1,50 @@ +// Package imds implements the Azure ARM Imds service API version 2019-02-01. +// +// The Azure Instance Metadata Client +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Imds + DefaultBaseURI = "https://169.254.169.254/metadata" +) + +// BaseClient is the base client for Imds. +type BaseClient struct { + autorest.Client + BaseURI string +} + +// New creates an instance of the BaseClient client. +func New() BaseClient { + return NewWithBaseURI(DefaultBaseURI) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } +} diff --git a/services/imds/2019-02-01/imds/enums.go b/services/imds/2019-02-01/imds/enums.go new file mode 100644 index 000000000000..cf693066734a --- /dev/null +++ b/services/imds/2019-02-01/imds/enums.go @@ -0,0 +1,66 @@ +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// BypassCache enumerates the values for bypass cache. +type BypassCache string + +const ( + // True ... + True BypassCache = "true" +) + +// PossibleBypassCacheValues returns an array of possible values for the BypassCache const type. +func PossibleBypassCacheValues() []BypassCache { + return []BypassCache{True} +} + +// Error enumerates the values for error. +type Error string + +const ( + // AccessDenied ... + AccessDenied Error = "access_denied" + // BadRequest ... + BadRequest Error = "bad_request" + // Forbidden ... + Forbidden Error = "forbidden" + // InvalidRequest ... + InvalidRequest Error = "invalid_request" + // InvalidScope ... + InvalidScope Error = "invalid_scope" + // MethodNotAllowed ... + MethodNotAllowed Error = "method_not_allowed" + // NotFound ... + NotFound Error = "not_found" + // ServerError ... + ServerError Error = "server_error" + // ServiceUnavailable ... + ServiceUnavailable Error = "service_unavailable" + // TooManyRequests ... + TooManyRequests Error = "too_many_requests" + // UnauthorizedClient ... + UnauthorizedClient Error = "unauthorized_client" + // UnsupportedResponseType ... + UnsupportedResponseType Error = "unsupported_response_type" +) + +// PossibleErrorValues returns an array of possible values for the Error const type. +func PossibleErrorValues() []Error { + return []Error{AccessDenied, BadRequest, Forbidden, InvalidRequest, InvalidScope, MethodNotAllowed, NotFound, ServerError, ServiceUnavailable, TooManyRequests, UnauthorizedClient, UnsupportedResponseType} +} diff --git a/services/imds/2019-02-01/imds/identity.go b/services/imds/2019-02-01/imds/identity.go new file mode 100644 index 000000000000..a032ce30a46e --- /dev/null +++ b/services/imds/2019-02-01/imds/identity.go @@ -0,0 +1,207 @@ +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IdentityClient is the the Azure Instance Metadata Client +type IdentityClient struct { + BaseClient +} + +// NewIdentityClient creates an instance of the IdentityClient client. +func NewIdentityClient() IdentityClient { + return NewIdentityClientWithBaseURI(DefaultBaseURI) +} + +// NewIdentityClientWithBaseURI creates an instance of the IdentityClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIdentityClientWithBaseURI(baseURI string) IdentityClient { + return IdentityClient{NewWithBaseURI(baseURI)} +} + +// GetInfo get information about AAD Metadata +func (client IdentityClient) GetInfo(ctx context.Context) (result IdentityInfoResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IdentityClient.GetInfo") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetInfoPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetInfo", nil, "Failure preparing request") + return + } + + resp, err := client.GetInfoSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetInfo", resp, "Failure sending request") + return + } + + result, err = client.GetInfoResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetInfo", resp, "Failure responding to request") + return + } + + return +} + +// GetInfoPreparer prepares the GetInfo request. +func (client IdentityClient) GetInfoPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/identity/info"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Metadata", "true")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetInfoSender sends the GetInfo request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityClient) GetInfoSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetInfoResponder handles the response to the GetInfo request. The method always +// closes the http.Response Body. +func (client IdentityClient) GetInfoResponder(resp *http.Response) (result IdentityInfoResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetToken get a Token from Azure AD +// Parameters: +// resource - this is the urlencoded identifier URI of the sink resource for the requested Azure AD token. The +// resulting token contains the corresponding aud for this resource. +// clientID - this identifies, by Azure AD client id, a specific explicit identity to use when authenticating +// to Azure AD. Mutually exclusive with object_id and msi_res_id. +// objectID - this identifies, by Azure AD object id, a specific explicit identity to use when authenticating +// to Azure AD. Mutually exclusive with client_id and msi_res_id. +// msiResID - this identifies, by urlencoded ARM resource id, a specific explicit identity to use when +// authenticating to Azure AD. Mutually exclusive with client_id and object_id. +// authority - this indicates the authority to request AAD tokens from. Defaults to the known authority of the +// identity to be used. +// bypassCache - if provided, the value must be 'true'. This indicates to the server that the token must be +// retrieved from Azure AD and cannot be retrieved from an internal cache. +func (client IdentityClient) GetToken(ctx context.Context, resource string, clientID string, objectID string, msiResID string, authority string, bypassCache BypassCache) (result IdentityTokenResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IdentityClient.GetToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetTokenPreparer(ctx, resource, clientID, objectID, msiResID, authority, bypassCache) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetToken", nil, "Failure preparing request") + return + } + + resp, err := client.GetTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetToken", resp, "Failure sending request") + return + } + + result, err = client.GetTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.IdentityClient", "GetToken", resp, "Failure responding to request") + return + } + + return +} + +// GetTokenPreparer prepares the GetToken request. +func (client IdentityClient) GetTokenPreparer(ctx context.Context, resource string, clientID string, objectID string, msiResID string, authority string, bypassCache BypassCache) (*http.Request, error) { + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "resource": autorest.Encode("query", resource), + } + if len(clientID) > 0 { + queryParameters["client_id"] = autorest.Encode("query", clientID) + } + if len(objectID) > 0 { + queryParameters["object_id"] = autorest.Encode("query", objectID) + } + if len(msiResID) > 0 { + queryParameters["msi_res_id"] = autorest.Encode("query", msiResID) + } + if len(authority) > 0 { + queryParameters["authority"] = autorest.Encode("query", authority) + } + if len(string(bypassCache)) > 0 { + queryParameters["bypass_cache"] = autorest.Encode("query", bypassCache) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/identity/oauth2/token"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Metadata", "true")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTokenSender sends the GetToken request. The method will close the +// http.Response Body if it receives an error. +func (client IdentityClient) GetTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetTokenResponder handles the response to the GetToken request. The method always +// closes the http.Response Body. +func (client IdentityClient) GetTokenResponder(resp *http.Response) (result IdentityTokenResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/imds/2019-02-01/imds/imdsapi/interfaces.go b/services/imds/2019-02-01/imds/imdsapi/interfaces.go new file mode 100644 index 000000000000..fe59c6420180 --- /dev/null +++ b/services/imds/2019-02-01/imds/imdsapi/interfaces.go @@ -0,0 +1,45 @@ +package imdsapi + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/imds/2019-02-01/imds" +) + +// InstancesClientAPI contains the set of methods on the InstancesClient type. +type InstancesClientAPI interface { + GetMetadata(ctx context.Context) (result imds.Instance, err error) +} + +var _ InstancesClientAPI = (*imds.InstancesClient)(nil) + +// AttestedClientAPI contains the set of methods on the AttestedClient type. +type AttestedClientAPI interface { + GetDocument(ctx context.Context, nonce string) (result imds.AttestedData, err error) +} + +var _ AttestedClientAPI = (*imds.AttestedClient)(nil) + +// IdentityClientAPI contains the set of methods on the IdentityClient type. +type IdentityClientAPI interface { + GetInfo(ctx context.Context) (result imds.IdentityInfoResponse, err error) + GetToken(ctx context.Context, resource string, clientID string, objectID string, msiResID string, authority string, bypassCache imds.BypassCache) (result imds.IdentityTokenResponse, err error) +} + +var _ IdentityClientAPI = (*imds.IdentityClient)(nil) diff --git a/services/imds/2019-02-01/imds/instances.go b/services/imds/2019-02-01/imds/instances.go new file mode 100644 index 000000000000..dbcae913ba10 --- /dev/null +++ b/services/imds/2019-02-01/imds/instances.go @@ -0,0 +1,110 @@ +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InstancesClient is the the Azure Instance Metadata Client +type InstancesClient struct { + BaseClient +} + +// NewInstancesClient creates an instance of the InstancesClient client. +func NewInstancesClient() InstancesClient { + return NewInstancesClientWithBaseURI(DefaultBaseURI) +} + +// NewInstancesClientWithBaseURI creates an instance of the InstancesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewInstancesClientWithBaseURI(baseURI string) InstancesClient { + return InstancesClient{NewWithBaseURI(baseURI)} +} + +// GetMetadata get Instance Metadata for the Virtual Machine. +func (client InstancesClient) GetMetadata(ctx context.Context) (result Instance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InstancesClient.GetMetadata") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetMetadataPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.InstancesClient", "GetMetadata", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetadataSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "imds.InstancesClient", "GetMetadata", resp, "Failure sending request") + return + } + + result, err = client.GetMetadataResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "imds.InstancesClient", "GetMetadata", resp, "Failure responding to request") + return + } + + return +} + +// GetMetadataPreparer prepares the GetMetadata request. +func (client InstancesClient) GetMetadataPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/instance"), + autorest.WithQueryParameters(queryParameters), + autorest.WithHeader("Metadata", "true")) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetadataSender sends the GetMetadata request. The method will close the +// http.Response Body if it receives an error. +func (client InstancesClient) GetMetadataSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetMetadataResponder handles the response to the GetMetadata request. The method always +// closes the http.Response Body. +func (client InstancesClient) GetMetadataResponder(resp *http.Response) (result Instance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/imds/2019-02-01/imds/models.go b/services/imds/2019-02-01/imds/models.go new file mode 100644 index 000000000000..a40e0b5f90fe --- /dev/null +++ b/services/imds/2019-02-01/imds/models.go @@ -0,0 +1,207 @@ +package imds + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/imds/2019-02-01/imds" + +// AttestedData this is the response from the Attested_GetDocument operation. +type AttestedData struct { + autorest.Response `json:"-"` + // Signature - This is the encoded string containing the VM ID, plan information, public key, timestamp, and nonce value. + Signature *string `json:"signature,omitempty"` + // Encoding - This is the encoding scheme of the signature. + Encoding *string `json:"encoding,omitempty"` +} + +// Compute compute Metadata +type Compute struct { + // AzEnvironment - This is the name of the environment in which the VM is running. + AzEnvironment *string `json:"azEnvironment,omitempty"` + // CustomData - This is the base64 encoded custom data for the running VM. + CustomData *string `json:"customData,omitempty"` + // Location - This is the Azure Region in which the VM is running. + Location *string `json:"location,omitempty"` + // Name - This is the name of the VM. + Name *string `json:"name,omitempty"` + // Offer - This is the offer information for the VM image. This value is only present for images deployed from the Azure Image Gallery. + Offer *string `json:"offer,omitempty"` + // OsType - This value indicates the type of OS the VM is running, either Linux or Windows. + OsType *string `json:"osType,omitempty"` + // PlacementGroupID - This is the placement group of your Virtual Machine Scale Set. + PlacementGroupID *string `json:"placementGroupId,omitempty"` + // Plan - This contains the data about the plan. + Plan *PlanProperties `json:"plan,omitempty"` + // PublicKeys - This is information about the SSH certificate + PublicKeys *[]PublicKeysProperties `json:"publicKeys,omitempty"` + // PlatformFaultDomain - This is the fault domain in which the VM. + PlatformFaultDomain *string `json:"platformFaultDomain,omitempty"` + // PlatformUpdateDomain - This is the update domain in which the VM. + PlatformUpdateDomain *string `json:"platformUpdateDomain,omitempty"` + // Provider - This is the provider of the VM. + Provider *string `json:"provider,omitempty"` + // Publisher - This is the publisher of the VM image. + Publisher *string `json:"publisher,omitempty"` + // ResourceGroupName - This is the resource group for the VM. + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // Sku - This is the specific SKU for the VM image. + Sku *string `json:"sku,omitempty"` + // SubscriptionID - This is the Azure subscription for the VM. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // Tags - This is the list of tags for your VM. + Tags *string `json:"tags,omitempty"` + // Version - This is the version of the VM image. + Version *string `json:"version,omitempty"` + // VMID - This is the unique identifier for the VM. + VMID *string `json:"vmId,omitempty"` + // VMScaleSetName - This is the resource name of the VMSS. + VMScaleSetName *string `json:"vmScaleSetName,omitempty"` + // VMSize - This is the size of the VM. + VMSize *string `json:"vmSize,omitempty"` + // Zone - This is the availability zone of the VM. + Zone *string `json:"zone,omitempty"` +} + +// ErrorResponse this is the response from an operation in the case an error occurs. +type ErrorResponse struct { + // Error - Error message indicating why the operation failed. + Error *string `json:"error,omitempty"` +} + +// IdentityErrorResponse this is the response from an Identity operation in the case an error occurs. +type IdentityErrorResponse struct { + // Error - Error code. Possible values include: 'InvalidRequest', 'UnauthorizedClient', 'AccessDenied', 'UnsupportedResponseType', 'InvalidScope', 'ServerError', 'ServiceUnavailable', 'BadRequest', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'TooManyRequests' + Error Error `json:"error,omitempty"` + // ErrorDescription - Error message indicating why the operation failed. + ErrorDescription *string `json:"error_description,omitempty"` +} + +// IdentityInfoResponse this is the response from the Identity_GetInfo operation. +type IdentityInfoResponse struct { + autorest.Response `json:"-"` + // TenantID - This is the AAD tenantId of the identity of the caller. + TenantID *string `json:"tenantId,omitempty"` +} + +// IdentityTokenResponse this is the response from the Identity_GetToken operation. +type IdentityTokenResponse struct { + autorest.Response `json:"-"` + // AccessToken - This is the requested access token. The app can use this token to authenticate to the sink resource. + AccessToken *string `json:"access_token,omitempty"` + // ExpiresIn - This is how long the access token is valid (in seconds). + ExpiresIn *string `json:"expires_in,omitempty"` + // ExpiresOn - This is the time when the access token expires. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. This value is used to determine the lifetime of cached tokens. + ExpiresOn *string `json:"expires_on,omitempty"` + // ExtExpiresIn - This indicates the extended lifetime of the token (in seconds). + ExtExpiresIn *string `json:"ext_expires_in,omitempty"` + // NotBefore - This is the time when the access token becomes effective. The date is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. + NotBefore *string `json:"not_before,omitempty"` + // Resource - This is the app ID URI of the sink resource. + Resource *string `json:"resource,omitempty"` + // TokenType - This indicates the token type value. + TokenType *string `json:"token_type,omitempty"` + // ClientID - This is the client_id specified in the request, if any. + ClientID *string `json:"client_id,omitempty"` + // ObjectID - This is the object_id specified in the request, if any. + ObjectID *string `json:"object_id,omitempty"` + // MsiResID - This is the msi_res_id specified in the request, if any. + MsiResID *string `json:"msi_res_id,omitempty"` +} + +// Instance this is the response from the Instance_GetMetadata operation. +type Instance struct { + autorest.Response `json:"-"` + // Compute - Compute Metadata + Compute *Compute `json:"compute,omitempty"` + // Network - Network Metadata + Network *Network `json:"network,omitempty"` +} + +// Ipv4Properties this contains the IPv4 properties. +type Ipv4Properties struct { + // PrivateIPAddress - This is the private IP address assigned to the interface. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // PublicIPAddress - This is the public IP address assigned to the interface. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` +} + +// Ipv6Properties this contains the IPv6 properties. +type Ipv6Properties struct { + // PrivateIPAddress - This is the private IPv6 address assigned to the interface. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// Network network Metadata +type Network struct { + // Interface - This contains data about the network interface. + Interface *[]NetworkInterface `json:"interface,omitempty"` +} + +// NetworkInterface this contains data about the network interface. +type NetworkInterface struct { + // Ipv4 - This contains the IPv4 address. + Ipv4 *NetworkInterfaceIpv4 `json:"ipv4,omitempty"` + // Ipv6 - This contains the IPv6 address. + Ipv6 *NetworkInterfaceIpv6 `json:"ipv6,omitempty"` + // MacAddress - This is the MAC address of the interface. + MacAddress *string `json:"macAddress,omitempty"` +} + +// NetworkInterfaceIpv4 this contains the IPv4 address. +type NetworkInterfaceIpv4 struct { + // IPAddress - This is the IP address + IPAddress *[]Ipv4Properties `json:"ipAddress,omitempty"` + // Subnet - This is the subnet + Subnet *[]SubnetProperties `json:"subnet,omitempty"` +} + +// NetworkInterfaceIpv6 this contains the IPv6 address. +type NetworkInterfaceIpv6 struct { + // IPAddress - This is the IP address + IPAddress *[]Ipv6Properties `json:"ipAddress,omitempty"` +} + +// PlanProperties this contains the data about the plan. +type PlanProperties struct { + // Name - This is the Plan ID. + Name *string `json:"name,omitempty"` + // Publisher - This is the publisher ID. + Publisher *string `json:"publisher,omitempty"` + // Product - This is the product of the image from the Marketplace. + Product *string `json:"product,omitempty"` +} + +// PublicKeysProperties this contains the data about the public key. +type PublicKeysProperties struct { + // Path - This specifies the full path on the VM where the SSH public key is stored. + Path *string `json:"path,omitempty"` + // KeyData - This is the SSH public key certificate used to authenticate with the VM. + KeyData *string `json:"keyData,omitempty"` +} + +// SubnetProperties this contains the properties of the subnet. +type SubnetProperties struct { + // Address - This is the address range of the subnet. + Address *string `json:"address,omitempty"` + // Prefix - This is the prefix of the subnet. + Prefix *string `json:"prefix,omitempty"` +} diff --git a/services/imds/2019-02-01/imds/version.go b/services/imds/2019-02-01/imds/version.go new file mode 100644 index 000000000000..5d45dd016c7b --- /dev/null +++ b/services/imds/2019-02-01/imds/version.go @@ -0,0 +1,30 @@ +package imds + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " imds/2019-02-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}