Documentation
¶
Overview ¶
zips package is where all the fun Azure client, cache, throttling, CRUD will go. Right now, it just provides an Apply and Delete interface
Index ¶
- Constants
- func GetSettingsFromEnvironment(env Enver) (s auth.EnvironmentSettings, err error)
- func IsNotFound(err error) bool
- func IsTerminalProvisioningState(state ProvisioningState) bool
- func WithEnv(env Enver) func(*ClientConfig) *ClientConfig
- func WithLogger(logger logr.Logger) func(*ClientConfig) *ClientConfig
- type ARMMeta
- type AnnotationKey
- type Applier
- type AzureTemplateClient
- func (atc *AzureTemplateClient) Apply(ctx context.Context, res *Resource) (*Resource, error)
- func (atc *AzureTemplateClient) BeginDelete(ctx context.Context, res *Resource) (*Resource, error)
- func (atc *AzureTemplateClient) DeleteApply(ctx context.Context, deploymentID string) error
- func (atc *AzureTemplateClient) GetResource(ctx context.Context, res *Resource) (*Resource, error)
- func (atc *AzureTemplateClient) HeadResource(ctx context.Context, res *Resource) (bool, error)
- type AzureTemplateClientOption
- type Client
- func (c *Client) Delete(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
- func (c *Client) DeleteResource(ctx context.Context, resourceID string, resource interface{}, ...) error
- func (c *Client) Get(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
- func (c *Client) GetResource(ctx context.Context, resourceID string, resource interface{}, ...) error
- func (c *Client) Head(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, entityPath string, body io.Reader, mw ...MiddlewareFunc) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, entityPath string, body io.Reader, mw ...MiddlewareFunc) (*http.Response, error)
- func (c *Client) PutDeployment(ctx context.Context, deployment *Deployment, mw ...MiddlewareFunc) (*Deployment, error)
- type ClientConfig
- type ClientOption
- type DebugSetting
- type Deployment
- type DeploymentMode
- type DeploymentProperties
- type DeploymentScope
- type DeploymentSpec
- type DeploymentStatus
- type DetailLevel
- type Enver
- type HttpError
- type MiddlewareFunc
- type NotFoundError
- type Output
- type OutputResource
- type ProvisioningState
- type Resource
- type ResourceMeta
- type RestHandler
- type SimpleTokenProvider
- type Template
- type TemplateOutput
- type TemplateResourceObjectOutput
Constants ¶
const ( ResourceGroupScope DeploymentScope = "resourceGroup" SubscriptionScope DeploymentScope = "subscription" RequestContentDetailLevel DetailLevel = "requestContent" ResponseContentDetailLevel DetailLevel = "responseContent" RequestAndResponseContentDetailLevel DetailLevel = "requestContent,responseContent" IncrementalDeploymentMode DeploymentMode = "Incremental" CompleteDeploymentMode DeploymentMode = "Complete" SucceededProvisioningState ProvisioningState = "Succeeded" FailedProvisioningState ProvisioningState = "Failed" DeletingProvisioningState ProvisioningState = "Deleting" AcceptedProvisioningState ProvisioningState = "Accepted" )
Variables ¶
This section is empty.
Functions ¶
func GetSettingsFromEnvironment ¶
func GetSettingsFromEnvironment(env Enver) (s auth.EnvironmentSettings, err error)
GetSettingsFromEnvironment returns the available authentication settings from the environment.
func IsNotFound ¶
func IsTerminalProvisioningState ¶
func IsTerminalProvisioningState(state ProvisioningState) bool
func WithEnv ¶
func WithEnv(env Enver) func(*ClientConfig) *ClientConfig
func WithLogger ¶
func WithLogger(logger logr.Logger) func(*ClientConfig) *ClientConfig
Types ¶
type AnnotationKey ¶
type AnnotationKey string
const ( // PreserveDeploymentAnnotation is the key which tells the applier to keep or delete the deployment PreserveDeploymentAnnotation AnnotationKey = "x-preserve-deployment" )
type Applier ¶
type Applier interface { Apply(ctx context.Context, res *Resource) (*Resource, error) DeleteApply(ctx context.Context, deploymentID string) error BeginDelete(ctx context.Context, res *Resource) (*Resource, error) GetResource(ctx context.Context, res *Resource) (*Resource, error) HeadResource(ctx context.Context, res *Resource) (bool, error) }
type AzureTemplateClient ¶
func NewAzureTemplateClient ¶
func NewAzureTemplateClient(opts ...AzureTemplateClientOption) (*AzureTemplateClient, error)
func (*AzureTemplateClient) BeginDelete ¶
func (*AzureTemplateClient) DeleteApply ¶
func (atc *AzureTemplateClient) DeleteApply(ctx context.Context, deploymentID string) error
func (*AzureTemplateClient) GetResource ¶
func (*AzureTemplateClient) HeadResource ¶
HeadResource checks to see if the resource exists
Note: this doesn't actually use HTTP HEAD as Azure Resource Manager does not uniformly implement HEAD for all all resources. Also, ARM returns a 400 rather than 405 when requesting HEAD for a resource which the Resource Provider does not implement HEAD. For these reasons, we use an HTTP GET
type AzureTemplateClientOption ¶
type AzureTemplateClientOption func(config *ClientConfig) *ClientConfig
type Client ¶
type Client struct { HTTPClient *http.Client Authorizer autorest.Authorizer Host string // contains filtered or unexported fields }
Client is the HTTP client for the Cloud Partner Portal
func NewClient ¶
func NewClient(authorizer autorest.Authorizer, opts ...ClientOption) (*Client, error)
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
Delete will execute a HTTP DELETE request
func (*Client) DeleteResource ¶
func (c *Client) DeleteResource(ctx context.Context, resourceID string, resource interface{}, mw ...MiddlewareFunc) error
DeleteResource will make an HTTP DELETE call to the resourceID and attempt to fill the resource with the response. If the body of the response is empty, the resource will be nil.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
Get will execute a HTTP GET request
func (*Client) GetResource ¶
func (*Client) Head ¶
func (c *Client) Head(ctx context.Context, entityPath string, mw ...MiddlewareFunc) (*http.Response, error)
Head will execute a HTTP HEAD request
func (*Client) Post ¶
func (c *Client) Post(ctx context.Context, entityPath string, body io.Reader, mw ...MiddlewareFunc) (*http.Response, error)
Post will execute a HTTP POST request
func (*Client) Put ¶
func (c *Client) Put(ctx context.Context, entityPath string, body io.Reader, mw ...MiddlewareFunc) (*http.Response, error)
Put will execute a HTTP PUT request
func (*Client) PutDeployment ¶
func (c *Client) PutDeployment(ctx context.Context, deployment *Deployment, mw ...MiddlewareFunc) (*Deployment, error)
type ClientConfig ¶
type ClientOption ¶
ClientOption is a variadic optional configuration func
type DebugSetting ¶
type DebugSetting struct {
DetailLevel DetailLevel `json:"detailLevel,omitempty"`
}
type Deployment ¶
type Deployment struct { ARMMeta `json:",inline"` Scope DeploymentScope `json:"-"` Properties *DeploymentProperties }
func NewResourceGroupDeployment ¶
func NewResourceGroupDeployment(subscriptionID, groupName, deploymentName string, resources ...*Resource) (*Deployment, error)
func NewSubscriptionDeployment ¶
func NewSubscriptionDeployment(subscriptionID, location, deploymentName string, resources ...*Resource) (*Deployment, error)
func (*Deployment) GetEntityPath ¶
func (d *Deployment) GetEntityPath() (string, error)
func (*Deployment) IsTerminalProvisioningState ¶
func (d *Deployment) IsTerminalProvisioningState() bool
func (*Deployment) ProvisioningStateOrUnknown ¶
func (d *Deployment) ProvisioningStateOrUnknown() string
func (*Deployment) Validate ¶
func (d *Deployment) Validate() error
type DeploymentMode ¶
type DeploymentMode string
type DeploymentProperties ¶
type DeploymentProperties struct { DeploymentStatus `json:",inline"` DeploymentSpec `json:",inline"` }
type DeploymentScope ¶
type DeploymentScope string
type DeploymentSpec ¶
type DeploymentSpec struct { DebugSetting *DebugSetting `json:"debugSetting,omitempty"` Mode DeploymentMode `json:"mode,omitempty"` Template *Template `json:"template,omitempty"` }
type DeploymentStatus ¶
type DeploymentStatus struct { ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` Timestamp *date.Time `json:"timestamp,omitempty"` Duration *duration.ISO8601 `json:"duration,omitempty"` CorrelationID string `json:"correlationId,omitempty"` Outputs json.RawMessage `json:"outputs,omitempty"` OutputResources []OutputResource `json:"outputResources,omitempty"` }
type DetailLevel ¶
type DetailLevel string
type MiddlewareFunc ¶
type MiddlewareFunc func(next RestHandler) RestHandler
MiddlewareFunc allows a consumer of the Client to inject handlers within the request / response pipeline
The example below adds the atom xml content type to the request, calls the next middleware and returns the result.
addAtomXMLContentType MiddlewareFunc = func(next RestHandler) RestHandler { return func(ctx context.Context, req *http.Request) (res *http.Response, e error) { if req.Method != http.MethodGet && req.Method != http.MethodHead { req.Header.Add("content-Type", "application/atom+xml;type=entry;charset=utf-8") } return next(ctx, req) } }
type NotFoundError ¶
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type OutputResource ¶
type OutputResource struct {
ID string `json:"id,omitempty"`
}
type ProvisioningState ¶
type ProvisioningState string
type Resource ¶
type Resource struct { ObjectMeta ResourceMeta `json:"-"` ResourceGroup string `json:"-"` // resource group should not be serialized as part of the resource. This indicates that this should be within a resource group or at a subscription level deployment. SubscriptionID string `json:"-"` ProvisioningState ProvisioningState `json:"-"` DeploymentID string `json:"-"` ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Location string `json:"location,omitempty"` Sku map[string]interface{} `json:"sku,omitempty"` Type string `json:"type,omitempty"` Tags map[string]string `json:"tags,omitempty"` ManagedBy string `json:"managedBy,omitempty"` APIVersion string `json:"apiVersion,omitempty"` Properties json.RawMessage `json:"properties,omitempty"` }
type ResourceMeta ¶
type ResourceMeta struct {
PreserveDeployment bool
}
type RestHandler ¶
RestHandler is used to transform a request and response within the http pipeline
type SimpleTokenProvider ¶
type SimpleTokenProvider struct{}
SimpleTokenProvider makes it easy to authorize with a string bearer token
func (SimpleTokenProvider) WithAuthorization ¶
func (s SimpleTokenProvider) WithAuthorization() autorest.PrepareDecorator
WithAuthorization will inject the AZURE_TOKEN env var as the bearer token for API auth
This is useful if you want to use a token from az cli. `AZURE_TOKEN=$(az account get-access-token --resource https://cloudpartner.azure.com --query "accessToken" -o tsv) pub publishers list`
type Template ¶
type Template struct { Schema string `json:"$schema,omitempty"` ContentVersion string `json:"contentVersion,omitempty"` Parameters interface{} `json:"parameters,omitempty"` Variables interface{} `json:"variables,omitempty"` Resources []*Resource `json:"resources,omitempty"` Outputs map[string]Output `json:"outputs,omitempty"` }
type TemplateOutput ¶
type TemplateOutput struct { Type string `json:"type,omitempty"` Value TemplateResourceObjectOutput `json:"value,omitempty"` }
type TemplateResourceObjectOutput ¶
type TemplateResourceObjectOutput struct { APIVersion string `json:"apiVersion,omitempty"` Location string `json:"location,omitempty"` Properties json.RawMessage `json:"properties,omitempty"` SubscriptionID string `json:"subscriptionId,omitempty"` Scope string `json:"scope,omitempty"` ID string `json:"id,omitempty"` ResourceID string `json:"resourceId,omitempty"` ReferenceAPIVersion string `json:"referenceApiVersion,omitempty"` Condition *bool `json:"condition,omitempty"` IsCondition *bool `json:"isConditionTrue,omitempty"` IsTemplateResource *bool `json:"isTemplateResource,omitempty"` IsAction *bool `json:"isAction,omitempty"` ProvisioningOperation string `json:"provisioningOperation,omitempty"` }
TemplateResourceObjectOutput represents the structure output from a deployment template for a given resource when requesting a 'Full' representation. The structure for a resource group is as follows:
{ "apiVersion": "2018-05-01", "location": "westus2", "properties": { "provisioningState": "Succeeded" }, "subscriptionId": "guid", "scope": "", "resourceId": "Microsoft.Resources/resourceGroups/foo", "referenceApiVersion": "2018-05-01", "condition": true, "isConditionTrue": true, "isTemplateResource": false, "isAction": false, "provisioningOperation": "Read" }