deploy

package
v0.0.0-...-355828d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Alphanumerics, underscores, parentheses, hyphens, periods, and unicode characters that match the regex documentation.
	// Can't end with period. Regex pattern: ^[-\w\._\(\)]+$
	ResourceGroupRT = ResourceType{Abbreviation: "rg", MaxLen: 90, AllowUpperCase: true, AllowHyphen: true}

	ContainerAppRT = ResourceType{Abbreviation: "app", MaxLen: 28, UseName: true, AllowHyphen: true}
	// Alphanumerics
	RegistryRT = ResourceType{Abbreviation: "cr", MaxLen: 50, AllowUpperCase: true}
	// Alphanumerics and hyphens. Start and end with alphanumeric.
	AnalyticsWorkspaceRT = ResourceType{Abbreviation: "log", MaxLen: 24, AllowHyphen: true}
	AssignmentRT         = ResourceType{Abbreviation: "assign", MaxLen: 64, UseName: true}
	KubeRT               = ResourceType{Abbreviation: "kube", MaxLen: 64, AllowUpperCase: true}
	// lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters.
	CosmosDBAccountRT            = ResourceType{Abbreviation: "cosmos", MaxLen: 50, AllowHyphen: true}
	MongoDBRT                    = ResourceType{Abbreviation: "mongo", MaxLen: 24, AllowUpperCase: true}
	ADApplicationRT              = ResourceType{Abbreviation: "aad-app", MaxLen: 64, UseName: true}
	ADServicePrincipalRT         = ResourceType{Abbreviation: "aad-sp", MaxLen: 64, UseName: true}
	ADServicePrincipalPasswordRT = ResourceType{Abbreviation: "aad-spp", MaxLen: 64, UseName: true}
	// Lowercase letters and numbers.
	StorageAccountRT = ResourceType{Abbreviation: "st", MaxLen: 24}
	// 	Lowercase letters, numbers, and hyphens.
	// Start with lowercase letter or number. Can't use consecutive hyphens.
	StorageContainerRT = ResourceType{MaxLen: 63, AllowHyphen: true, UseName: true}
	// Lowercase letters, numbers, and hyphens.
	// Can't start or end with hyphen. Can't use consecutive hyphens.
	StorageQueueRT = ResourceType{MaxLen: 63, AllowHyphen: true, UseName: true}
	// Alphanumerics and hyphens. Start with letter. End with letter or digit. Can't contain consecutive hyphens.
	KeyVaultRT = ResourceType{Abbreviation: "kv", MaxLen: 14, AllowUpperCase: true}
	// Alphanumerics and hyphens.
	EventGridRT = ResourceType{Abbreviation: "evgt", MaxLen: 24, AllowUpperCase: true, AllowHyphen: true, UseName: true}
	// Alphanumerics and hyphens.
	EventSubscriptionRT = ResourceType{Abbreviation: "sub", MaxLen: 24, AllowUpperCase: true, AllowHyphen: true, UseName: true}
	// Alphanumerics and hyphens, Start with letter and end with alphanumeric.
	ApiRT = ResourceType{Abbreviation: "api", MaxLen: 80, AllowHyphen: true, AllowUpperCase: true}
	// Alphanumerics and hyphens, Start with letter and end with alphanumeric.
	ApiHttpProxyRT = ResourceType{Abbreviation: "httpproxy", MaxLen: 80, AllowHyphen: true, AllowUpperCase: true, UseName: true}
	// Alphanumerics and hyphens, Start with letter and end with alphanumeric.
	ApiManagementRT = ResourceType{Abbreviation: "api-mgmt", MaxLen: 80, AllowHyphen: true, AllowUpperCase: true}
	// Alphanumerics and hyphens, Start with letter and end with alphanumeric.
	ApiManagementServiceRT = ResourceType{Abbreviation: "api-mgmt", MaxLen: 50, AllowHyphen: true, AllowUpperCase: true}
	ApiManagementProxyRT   = ResourceType{Abbreviation: "proxy-mgmt", MaxLen: 50, AllowHyphen: true, AllowUpperCase: true, UseName: true}
	// Alphanumerics and hyphens, Start with letter and end with alphanumeric.
	ApiOperationPolicyRT = ResourceType{Abbreviation: "api-op-pol", MaxLen: 80, AllowUpperCase: true, AllowHyphen: true, UseName: true}
	// Lowercase letters and numbers.
	DatabaseServerRT = ResourceType{Abbreviation: "pg-svr", MaxLen: 24}
)

https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules

View Source
var RoleDefinitions = map[string]string{
	"KVSecretsOfficer":    "b86a8fe4-44ce-4948-aee5-eccb2c155cd7",
	"BlobDataContrib":     "ba92f5b4-2d11-453d-a403-e96b0029c9fe",
	"QueueDataContrib":    "974c5e8b-45b9-4653-ba55-5f855dd0fb88",
	"EventGridDataSender": "d5a91429-5739-47e2-a06b-3470a27159e7",

	"TagContributor": "4a9ae827-6dc8-4573-8ac7-8239d42aa03f",
}

Built in role definitions for Azure See below URL for mapping https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles

Functions

func JoinCamelCase

func JoinCamelCase(ss []string) string

func ResourceName

func ResourceName(ctx *pulumi.Context, name string, rt ResourceType) string

ResourceName generates a name for the deployed version of a resource in Azure. follows restrictions like max length, hyphenation, etc.

func StringTrunc

func StringTrunc(s string, max int) string

Types

type ApiResources

type ApiResources struct {
	ApiManagementService *apimanagement.ApiManagementService
	Api                  *apimanagement.Api
}

type AzureApiConfig

type AzureApiConfig struct {
	Description string
}

type AzureConfig

type AzureConfig struct {
	Refresh                                 bool
	ResourceGroup                           string `mapstructure:"resource-group"`
	Org                                     string `mapstructure:"org"`
	AdminEmail                              string `mapstructure:"adminemail"`
	Apis                                    map[string]*AzureApiConfig
	config.AbstractConfig[*AzureConfigItem] `mapstructure:"config,squash"`
}

func ConfigFromAttributes

func ConfigFromAttributes(attributes map[string]interface{}) (*AzureConfig, error)

Return AzureConfig from stack attributes

type AzureConfigItem

type AzureConfigItem struct {
	ContainerApps *AzureContainerAppsConfig `mapstructure:"containerapps,omitempty"`
	Telemetry     int
}

type AzureContainerAppsConfig

type AzureContainerAppsConfig struct {
	Cpu         float64
	Memory      float64
	MinReplicas int `mapstructure:"min-replicas"`
	MaxReplicas int `mapstructure:"max-replicas"`
}

type AzureEventGridTopic

type AzureEventGridTopic struct {
	pulumi.ResourceState

	Name               string
	SourceResourceName string
	Topic              *eventgrid.Topic
}

Topics

type AzureEventGridTopicArgs

type AzureEventGridTopicArgs struct {
	StackID       string
	ResourceGroup *resources.ResourceGroup
}

type AzureHttpProxy

type AzureHttpProxy struct {
	pulumi.ResourceState

	Name    string
	Api     *apimanagement.Api
	Service *apimanagement.ApiManagementService
}

type AzureHttpProxyArgs

type AzureHttpProxyArgs struct {
	StackID           string
	ResourceGroupName pulumi.StringInput
	OrgName           pulumi.StringInput
	AdminEmail        pulumi.StringInput
	App               *ContainerApp
	ManagedIdentity   *managedidentity.UserAssignedIdentity
}

type ContainerApp

type ContainerApp struct {
	pulumi.ResourceState

	Name string

	Sp         *ServicePrincipal
	App        *app.ContainerApp
	EventToken pulumi.StringOutput
	// contains filtered or unexported fields
}

func (*ContainerApp) HostUrl

func (c *ContainerApp) HostUrl() (pulumi.StringOutput, error)

HostUrl - Returns the HostURL of the application this will also ensure that the application has been successfully deployed

type ContainerAppArgs

type ContainerAppArgs struct {
	ResourceGroupName             pulumi.StringInput
	Location                      pulumi.StringInput
	StackID                       string
	SubscriptionID                pulumi.StringInput
	Registry                      *containerregistry.Registry
	RegistryUser                  pulumi.StringPtrInput
	RegistryPass                  pulumi.StringPtrInput
	ManagedEnv                    *app.ManagedEnvironment
	Env                           app.EnvironmentVarArray
	ImageUri                      pulumi.StringInput
	Service                       *deploy.Service
	ManagedIdentityID             pulumi.StringOutput
	MongoDatabaseName             pulumi.StringInput
	MongoDatabaseConnectionString pulumi.StringInput
	Config                        AzureContainerAppsConfig
	Schedules                     []*deploy.Resource
}

type ContainerEnv

type ContainerEnv struct {
	pulumi.ResourceState

	Name           string
	DockerProvider *docker.Provider
	Registry       *containerregistry.Registry
	RegistryArgs   *docker.RegistryArgs
	ManagedEnv     *app.ManagedEnvironment
	Env            app.EnvironmentVarArray
	ManagedUser    *managedidentity.UserAssignedIdentity
}

type ContainerEnvArgs

type ContainerEnvArgs struct {
	// ResourceGroupName pulumi.StringInput
	// Location          pulumi.StringInput
	EnvMap map[string]string
}

type NitricAzurePulumiProvider

type NitricAzurePulumiProvider struct {
	*deploy.CommonStackDetails

	StackId string

	AzureConfig *AzureConfig

	ClientConfig *authorization.GetClientConfigResult

	ResourceGroup  *resources.ResourceGroup
	KeyVault       *keyvault.Vault
	StorageAccount *storage.StorageAccount

	ContainerEnv *ContainerEnv

	Apis        map[string]ApiResources
	HttpProxies map[string]ApiResources
	Buckets     map[string]*storage.BlobContainer

	Queues map[string]*storage.Queue

	Principals map[resourcespb.ResourceType]map[string]*ServicePrincipal

	ContainerApps map[string]*ContainerApp
	Topics        map[string]*eventgrid.Topic

	KeyValueStores map[string]*storage.Table

	SqlMigrations    map[string]*containerinstance.ContainerGroup
	DatabaseServer   *dbforpostgresql.Server
	DbMasterPassword *random.RandomPassword
	VirtualNetwork   *network.VirtualNetwork

	DatabaseSubnet       *network.Subnet
	InfrastructureSubnet *network.Subnet
	ContainerGroupSubnet *network.Subnet

	Roles *Roles
	provider.NitricDefaultOrder
	// contains filtered or unexported fields
}

func NewNitricAzurePulumiProvider

func NewNitricAzurePulumiProvider() *NitricAzurePulumiProvider

func (*NitricAzurePulumiProvider) Api

func (p *NitricAzurePulumiProvider) Api(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Api) error

func (*NitricAzurePulumiProvider) Batch

func (p *NitricAzurePulumiProvider) Batch(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Batch, runtimeProvider provider.RuntimeProvider) error

func (*NitricAzurePulumiProvider) Bucket

func (p *NitricAzurePulumiProvider) Bucket(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Bucket) error

func (*NitricAzurePulumiProvider) Config

func (*NitricAzurePulumiProvider) Http

func (*NitricAzurePulumiProvider) Init

func (a *NitricAzurePulumiProvider) Init(attributes map[string]interface{}) error

func (*NitricAzurePulumiProvider) KeyValueStore

func (p *NitricAzurePulumiProvider) KeyValueStore(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.KeyValueStore) error

func (*NitricAzurePulumiProvider) Policy

func (p *NitricAzurePulumiProvider) Policy(ctx *pulumi.Context, parent pulumi.Resource, name string, policy *deploymentspb.Policy) error

func (*NitricAzurePulumiProvider) Post

func (*NitricAzurePulumiProvider) Pre

func (a *NitricAzurePulumiProvider) Pre(ctx *pulumi.Context, nitricResources []*pulumix.NitricPulumiResource[any]) error

func (*NitricAzurePulumiProvider) Queue

func (a *NitricAzurePulumiProvider) Queue(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Queue) error

func (*NitricAzurePulumiProvider) Result

func (*NitricAzurePulumiProvider) Schedule

func (p *NitricAzurePulumiProvider) Schedule(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Schedule) error

func (*NitricAzurePulumiProvider) Secret

func (p *NitricAzurePulumiProvider) Secret(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Secret) error

func (*NitricAzurePulumiProvider) Service

func (*NitricAzurePulumiProvider) SqlDatabase

func (a *NitricAzurePulumiProvider) SqlDatabase(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.SqlDatabase) error

func (*NitricAzurePulumiProvider) Topic

func (p *NitricAzurePulumiProvider) Topic(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Topic) error

func (*NitricAzurePulumiProvider) Websocket

func (a *NitricAzurePulumiProvider) Websocket(ctx *pulumi.Context, parent pulumi.Resource, name string, config *deploymentspb.Websocket) error

type Policy

type Policy struct {
	pulumi.ResourceState

	Name string
}

type PrincipalMap

type PrincipalMap = map[resourcespb.ResourceType]map[string]*ServicePrincipal

type ResourceType

type ResourceType struct {
	Abbreviation   string
	MaxLen         int
	AllowUpperCase bool
	AllowHyphen    bool
	UseName        bool
}

type RoleDefinition

type RoleDefinition struct {
	Description      pulumi.StringInput
	Permissions      authorization.PermissionArray
	AssignableScopes pulumi.StringArray
}

type Roles

type Roles struct {
	pulumi.ResourceState

	Name            string
	RoleDefinitions map[resourcespb.Action]*authorization.RoleDefinition
}

func CreateRoles

func CreateRoles(ctx *pulumi.Context, stackId string, subscriptionId string, rgName pulumi.StringInput) (*Roles, error)

type Schedule

type Schedule struct {
	pulumi.ResourceState
	Name      string
	Component *app.DaprComponent
}

type ScheduleArgs

type ScheduleArgs struct {
	ResourceGroupName pulumi.StringInput
	Target            *ContainerApp
	Environment       *app.ManagedEnvironment
	Schedule          *deploymentspb.Schedule
}

type ServicePrincipal

type ServicePrincipal struct {
	pulumi.ResourceState
	Name               string
	ClientID           pulumi.StringOutput
	TenantID           pulumi.StringOutput
	ServicePrincipalId pulumi.StringOutput
	ClientSecret       pulumi.StringOutput
}

func NewServicePrincipal

func NewServicePrincipal(ctx *pulumi.Context, name string, args *ServicePrincipalArgs, opts ...pulumi.ResourceOption) (*ServicePrincipal, error)

type ServicePrincipalArgs

type ServicePrincipalArgs struct{}

type StackRoles

type StackRoles struct {
	pulumi.ResourceState

	Name               string
	ClientID           pulumi.StringOutput
	TenantID           pulumi.StringOutput
	ServicePrincipalId pulumi.StringOutput
	ClientSecret       pulumi.StringOutput
}

type StackRolesArgs

type StackRolesArgs struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL