diff --git a/profiles/preview/containerinstance/mgmt/containerinstance/containerinstanceapi/models.go b/profiles/preview/containerinstance/mgmt/containerinstance/containerinstanceapi/models.go index 13e3b657a236..34e154d7ab09 100644 --- a/profiles/preview/containerinstance/mgmt/containerinstance/containerinstanceapi/models.go +++ b/profiles/preview/containerinstance/mgmt/containerinstance/containerinstanceapi/models.go @@ -21,6 +21,7 @@ package containerinstanceapi import original "github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance/containerinstanceapi" +type BaseClientAPI = original.BaseClientAPI type ContainerClientAPI = original.ContainerClientAPI type ContainerGroupUsageClientAPI = original.ContainerGroupUsageClientAPI type ContainerGroupsClientAPI = original.ContainerGroupsClientAPI diff --git a/profiles/preview/containerinstance/mgmt/containerinstance/models.go b/profiles/preview/containerinstance/mgmt/containerinstance/models.go index 771dfe7e14ae..b4bf91d13b72 100644 --- a/profiles/preview/containerinstance/mgmt/containerinstance/models.go +++ b/profiles/preview/containerinstance/mgmt/containerinstance/models.go @@ -105,6 +105,13 @@ const ( type AzureFileVolume = original.AzureFileVolume type BaseClient = original.BaseClient +type CachedImages = original.CachedImages +type CachedImagesListResult = original.CachedImagesListResult +type Capabilities = original.Capabilities +type CapabilitiesCapabilities = original.CapabilitiesCapabilities +type CapabilitiesListResult = original.CapabilitiesListResult +type CloudError = original.CloudError +type CloudErrorBody = original.CloudErrorBody type Container = original.Container type ContainerClient = original.ContainerClient type ContainerExec = original.ContainerExec diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/client.go b/services/containerinstance/mgmt/2018-10-01/containerinstance/client.go index 6131ee45c4fc..7cb91fb5cdef 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/client.go +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/client.go @@ -21,7 +21,11 @@ package containerinstance // 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" ) const ( @@ -49,3 +53,153 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { SubscriptionID: subscriptionID, } } + +// ListCachedImages get the list of cached images on specific OS type for a subscription in a region. +// Parameters: +// location - the identifier for the physical azure location. +func (client BaseClient) ListCachedImages(ctx context.Context, location string) (result CachedImagesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListCachedImages") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCachedImagesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCachedImages", nil, "Failure preparing request") + return + } + + resp, err := client.ListCachedImagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCachedImages", resp, "Failure sending request") + return + } + + result, err = client.ListCachedImagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCachedImages", resp, "Failure responding to request") + } + + return +} + +// ListCachedImagesPreparer prepares the ListCachedImages request. +func (client BaseClient) ListCachedImagesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCachedImagesSender sends the ListCachedImages request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListCachedImagesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListCachedImagesResponder handles the response to the ListCachedImages request. The method always +// closes the http.Response Body. +func (client BaseClient) ListCachedImagesResponder(resp *http.Response) (result CachedImagesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListCapabilities get the list of CPU/memory/GPU capabilities of a region. +// Parameters: +// location - the identifier for the physical azure location. +func (client BaseClient) ListCapabilities(ctx context.Context, location string) (result CapabilitiesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ListCapabilities") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListCapabilitiesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCapabilities", nil, "Failure preparing request") + return + } + + resp, err := client.ListCapabilitiesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCapabilities", resp, "Failure sending request") + return + } + + result, err = client.ListCapabilitiesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerinstance.BaseClient", "ListCapabilities", resp, "Failure responding to request") + } + + return +} + +// ListCapabilitiesPreparer prepares the ListCapabilities request. +func (client BaseClient) ListCapabilitiesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCapabilitiesSender sends the ListCapabilities request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ListCapabilitiesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListCapabilitiesResponder handles the response to the ListCapabilities request. The method always +// closes the http.Response Body. +func (client BaseClient) ListCapabilitiesResponder(resp *http.Response) (result CapabilitiesListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/containerinstanceapi/interfaces.go b/services/containerinstance/mgmt/2018-10-01/containerinstance/containerinstanceapi/interfaces.go index 5454a119bfe6..a782941691a5 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/containerinstanceapi/interfaces.go +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/containerinstanceapi/interfaces.go @@ -23,6 +23,14 @@ import ( "github.com/Azure/go-autorest/autorest" ) +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + ListCachedImages(ctx context.Context, location string) (result containerinstance.CachedImagesListResult, err error) + ListCapabilities(ctx context.Context, location string) (result containerinstance.CapabilitiesListResult, err error) +} + +var _ BaseClientAPI = (*containerinstance.BaseClient)(nil) + // ContainerGroupsClientAPI contains the set of methods on the ContainerGroupsClient type. type ContainerGroupsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, containerGroupName string, containerGroup containerinstance.ContainerGroup) (result containerinstance.ContainerGroupsCreateOrUpdateFuture, err error) diff --git a/services/containerinstance/mgmt/2018-10-01/containerinstance/models.go b/services/containerinstance/mgmt/2018-10-01/containerinstance/models.go index 56086d070990..922c9f898dea 100644 --- a/services/containerinstance/mgmt/2018-10-01/containerinstance/models.go +++ b/services/containerinstance/mgmt/2018-10-01/containerinstance/models.go @@ -201,6 +201,77 @@ type AzureFileVolume struct { StorageAccountKey *string `json:"storageAccountKey,omitempty"` } +// CachedImages the cached image and OS type. +type CachedImages struct { + // ID - The resource Id of the cached image. + ID *string `json:"id,omitempty"` + // OsType - The OS type of the cached image. + OsType *string `json:"osType,omitempty"` + // Image - The cached image name. + Image *string `json:"image,omitempty"` +} + +// CachedImagesListResult the response containing cached images. +type CachedImagesListResult struct { + autorest.Response `json:"-"` + // Value - The list of cached images. + Value *[]CachedImages `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of cached images. + NextLink *string `json:"nextLink,omitempty"` +} + +// Capabilities the regional capabilities. +type Capabilities struct { + // ResourceType - The resource type that this capability describes. + ResourceType *string `json:"resourceType,omitempty"` + // OsType - The OS type that this capability describes. + OsType *string `json:"osType,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // IPAddressType - The ip address type that this capability describes. + IPAddressType *string `json:"ipAddressType,omitempty"` + // Gpu - The GPU sku that this capability describes. + Gpu *string `json:"gpu,omitempty"` + // Capabilities - The supported capabilities. + Capabilities *CapabilitiesCapabilities `json:"capabilities,omitempty"` +} + +// CapabilitiesCapabilities the supported capabilities. +type CapabilitiesCapabilities struct { + // MaxMemoryInGB - The maximum allowed memory request in GB. + MaxMemoryInGB *float64 `json:"maxMemoryInGB,omitempty"` + // MaxCPU - The maximum allowed CPU request in cores. + MaxCPU *float64 `json:"maxCpu,omitempty"` + // MaxGpuCount - The maximum allowed GPU count. + MaxGpuCount *float64 `json:"maxGpuCount,omitempty"` +} + +// CapabilitiesListResult the response containing list of capabilities. +type CapabilitiesListResult struct { + autorest.Response `json:"-"` + // Value - The list of capabilities. + Value *[]Capabilities `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of capabilities. + NextLink *string `json:"nextLink,omitempty"` +} + +// CloudError an error response from the Batch service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Batch service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + // Container a container instance. type Container struct { // Name - The user-provided name of the container instance. @@ -922,6 +993,8 @@ type Operation struct { Name *string `json:"name,omitempty"` // Display - The display information of the operation. Display *OperationDisplay `json:"display,omitempty"` + // Properties - The additional properties. + Properties interface{} `json:"properties,omitempty"` // Origin - The intended executor of the operation. Possible values include: 'User', 'System' Origin OperationsOrigin `json:"origin,omitempty"` }