Giter Site home page Giter Site logo

azure-libraries-for-swift's Introduction

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 [email protected] with any additional questions or comments.

azure-libraries-for-swift's People

Contributors

alvabandy avatar alvadb avatar microsoftopensource avatar msftgits avatar vladimir-shcherbakov avatar yungezz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-libraries-for-swift's Issues

LF instead of CRLF?

How much of this codebase is being generated? Whats the possibility to generate with LF instead of windows line endings? Some of the Swift tooling is not able to handle CRLF correctly yet. realm/SwiftLint#1786

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.