Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Action]: Azure Create Azure Storage Account #398

Open
1 task done
dougsillars opened this issue Mar 31, 2023 · 0 comments
Open
1 task done

[Action]: Azure Create Azure Storage Account #398

dougsillars opened this issue Mar 31, 2023 · 0 comments
Labels

Comments

@dougsillars
Copy link
Contributor

Contact Details

No response

Action Name

Azure Create Azure Storage Account

Action Readme

unSkript

Create Azure Storage Account

Description

This Lego creates a new Azure Storage Account.

Lego Details

azure_create_storage_account(handle: object, name: str, resource_group: str, location: str)

    handle: Object of type unSkript Azure Connector.
    name: Name of the storage account to be created.
    resource_group: Resource Group of the Azure Storage Account.
    location: Azure Location of the storage account.

Lego Input

This Lego takes four inputs: handle, name, resource_group, and location.

Lego Output

Here is a sample output.
Output

See it in Action

You can see this Lego in action following this link unSkript Live

Action json

{
"action_title": "Create Azure Storage Account",
"action_description": "Create a new Azure Storage Account",
"action_type": "LEGO_TYPE_AZURE",
"action_entry_function": "azure_create_storage_account",
"action_needs_credential": true,
"action_supports_poll": true,
"action_output_type": "ACTION_OUTPUT_TYPE_DICT",
"action_supports_iteration": true
}

Action python

Copyright (c) 2023 unSkript, Inc

All rights reserved.

from pydantic import BaseModel, Field
from typing import Optional, Dict
from azure.storage.blob import BlobServiceClient
import pprint

class InputSchema(BaseModel):
name: str = Field(
title='Storage Account Name',
description='Name of the storage account to be created.')
resource_group: str = Field(
title='Resource Group',
description='Resource Group of the Azure Storage Account.')
location: Optional[str] = Field(
title='Location',
description='Azure Location of the storage account.')

def azure_create_storage_account_printer(output):
if output is None:
return
pprint.pprint(output)

def azure_create_storage_account(handle: object, name: str, resource_group: str, location: str = None) -> Dict:
"""azure_create_storage_account Creates a new Azure Storage Account.
:rtype: Dict with the new storage account info.
"""
# Input param validation.
storage_mgmt_client = handle.storage_mgmt_client

if location is None:
    location = handle.default_location

async_operation = storage_mgmt_client.storage_accounts.create(
    resource_group,
    name,
    {
        'sku': {'name': 'Standard_LRS'},
        'kind': 'StorageV2',
        'location': location
    }
)
storage_account = async_operation.result()
return {'name': storage_account.name, 'location': storage_account.location}

Action Outputs

na

Comments

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant