Azure libraries for swift
Перейти к файлу
Yunge Zhu b7321f3c71
Merge pull request #11 from Azure/yungezz-patch-1
readme, add archive notification
2021-02-01 17:29:10 +08:00
analysisservices/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
appservice/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
automation/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
batch/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
batchService/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
batchai/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
billing/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
cdn/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
cognitiveservices/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
compute/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
consumption/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
containerinstance/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
containerregistry/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
containerservice/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
cosmosdb/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
customerinsights/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
datalakeanalyticsaccount/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
datalakestoreaccount/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
devtestlab/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
dns/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
eventhub/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
graphrbac/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
iothub/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
keyvault/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
logic/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
monitor/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
msi/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
network/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
notificationhubs/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
powerbi/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
recoveryservices/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
recoveryservicesbackup/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
recoveryservicessiterecovery/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
redis/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
relay/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
scheduler/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
search/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
servermanagement/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
servicebus/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
servicefabric/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
sql/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
storage Merge pull request #7 from alvadb/master 2018-03-09 11:44:34 -08:00
streamanalytics/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
trafficmanager/resource-manager Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
.gitignore Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
AUTH.md Update to readme 2018-03-09 11:59:20 -08:00
LICENSE Initial commit 2017-10-09 11:02:48 -07:00
README.md Update README.md 2021-02-01 17:28:10 +08:00
api-specs.json Initial check of managmeent sdks. 2018-02-13 22:48:02 -08:00
api-specs.json.bak Updates to fix encoding command coding issue. 2018-03-09 11:43:57 -08:00
gulpfile.js Initial check of managmeent sdks. 2018-02-13 22:48:02 -08:00
package-lock.json Initial check of managmeent sdks. 2018-02-13 22:48:02 -08:00

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

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

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.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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.