b7321f3c71
readme, add archive notification |
||
---|---|---|
analysisservices/resource-manager | ||
appservice/resource-manager | ||
automation/resource-manager | ||
batch/resource-manager | ||
batchService/resource-manager | ||
batchai/resource-manager | ||
billing/resource-manager | ||
cdn/resource-manager | ||
cognitiveservices/resource-manager | ||
compute/resource-manager | ||
consumption/resource-manager | ||
containerinstance/resource-manager | ||
containerregistry/resource-manager | ||
containerservice/resource-manager | ||
cosmosdb/resource-manager | ||
customerinsights/resource-manager | ||
datalakeanalyticsaccount/resource-manager | ||
datalakestoreaccount/resource-manager | ||
devtestlab/resource-manager | ||
dns/resource-manager | ||
eventhub/resource-manager | ||
graphrbac/resource-manager | ||
iothub/resource-manager | ||
keyvault/resource-manager | ||
logic/resource-manager | ||
monitor/resource-manager | ||
msi/resource-manager | ||
network/resource-manager | ||
notificationhubs/resource-manager | ||
powerbi/resource-manager | ||
recoveryservices/resource-manager | ||
recoveryservicesbackup/resource-manager | ||
recoveryservicessiterecovery/resource-manager | ||
redis/resource-manager | ||
relay/resource-manager | ||
scheduler/resource-manager | ||
search/resource-manager | ||
servermanagement/resource-manager | ||
servicebus/resource-manager | ||
servicefabric/resource-manager | ||
sql/resource-manager | ||
storage | ||
streamanalytics/resource-manager | ||
trafficmanager/resource-manager | ||
.gitignore | ||
AUTH.md | ||
LICENSE | ||
README.md | ||
api-specs.json | ||
api-specs.json.bak | ||
gulpfile.js | ||
package-lock.json |
README.md
Azure Management Libraries for Swift (BETA)
The repository is in archive mode now. The Azure Management Libraries for Swift is a higher-level, object-oriented API for managing Azure resources, that is optimized for ease of use, succinctness and consistency.
Table of contents
- Feature availability
- Code snippets and samples
- Prerequisites
- Help and issues
- Contribute code
- More information
Feature Availability
This is a Preview release. The goal for the preview is to be able to determine the community need for Azure management swift libraires and to get feedback from the community on the usability and approach of the current generated librairies.
Code snippets and samples
Azure Authentication
To learn more about authentication in the Azure Libraries for Swift, see AUTH.md.
Virtual Machines
Create a Virtual Machine
You can create a virtual machine instance by using a define() … create()
method chain.
let resourceGroupName = "swiftTestResourceGroup1"
let vmName = "<vm name>"
let osDiskName = "<os disk name>"
let adminUsername = "<user name>"
let adminPassword = "<password>"
let computerName = "<computer name>"
let nicId = "<id for nic>"
var vmProperties = compute.DataFactory.createVirtualMachinePropertiesProtocol()
var hardwareProfile = compute.DataFactory.createHardwareProfileProtocol()
hardwareProfile.vmSize = VirtualMachineSizeTypesEnum.VirtualMachineSizeTypesBasicA0
vmProperties.hardwareProfile = hardwareProfile
var networkProfile = compute.DataFactory.createNetworkProfileProtocol()
networkProfile.networkInterfaces = [NetworkInterfaceReferenceProtocol?]()
var networkInterface = compute.DataFactory.createNetworkInterfaceReferenceProtocol()
networkInterface.id = nicId
networkProfile.networkInterfaces?.append(networkInterface)
vmProperties.networkProfile = networkProfile
var storageProfile = compute.DataFactory.createStorageProfileProtocol();
var imageReference = compute.DataFactory.createImageReferenceProtocol()
imageReference.sku = "16.04-LTS"
imageReference.publisher = "Canonical"
imageReference.version = "latest"
imageReference.offer = "UbuntuServer"
storageProfile.imageReference = imageReference
var osDisk = compute.DataFactory.createOSDiskProtocol(createOption: DiskCreateOptionTypesEnum.DiskCreateOptionTypesFromImage)
osDisk.name = osDiskName
osDisk.caching = CachingTypesEnum.CachingTypesReadWrite
osDisk.managedDisk = compute.DataFactory.createManagedDiskParametersProtocol()
osDisk.managedDisk?.storageAccountType = StorageAccountTypesEnum.StandardLRS
storageProfile.osDisk = osDisk
vmProperties.storageProfile = storageProfile
var osProfile = compute.DataFactory.createOSProfileProtocol()
osProfile = compute.DataFactory.createOSProfileProtocol()
osProfile.adminUsername = adminUsername
osProfile.adminPassword = adminPassword
osProfile.computerName = computerName
vmProperties.osProfile = osProfile
var vm = compute.DataFactory.createVirtualMachineProtocol(location: "west us");
vm.name = vmName
vm.properties = vmProperties;
let e = expectation(description: "Wait for HTTP request to complete")
// This is an example of a functional test case.
var command = compute.Commands.VirtualMachines.CreateOrUpdate(
resourceGroupName: resourceGroupName,
vmName: vm.name!,
subscriptionId: applicationTokenCredentials.defaultSubscriptionId!,
parameters: vm)
command.execute(client: self.azureClient, completionHandler: {
(resource, error) -> Void in
e.fulfill()
print("done");
});
waitForExpectations(timeout: 600, handler: nil)
Prerequisites
- Swift 4
- Azure Service Principal - see how to create authentication info.
Help and Issues
If you encounter any bugs with these libraries, please file issues via Issues.
Contribute Code
If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.