共用方式為


Create a connection type

 

The Create a connection type operation defines a set of user-defined fields, similar to a class. You can think of connections as instances of connection types, with values for the fields that you defined in the connection type. Connection types can be created by importing Microsoft Azure Automation integration modules, or by using the create API shown below.

Request

To specify the request, replace <subscription-id> with your subscription ID, <cloud-service-name> with the name of the cloud service to use for making the request, <automation-account-name> with the name of the automation account to use for making the request, and <connection-type-name> with a name for the connection type. Include required URI parameters.

Method

Request URI

PUT

https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/connectionTypes/<connection-type-name>?api-version=2014-12-08

URI Parameters

Uri Parameter

Description

api-version

Required. Must be set to 2014-12-08.

Request Headers

The request headers in the following table are required.

Request Header

Description

Content-Type

Set to application/json. Do not include a specification for charset.

x-ms-version

Specifies the version of the operation. Set to 2013-06-01 or a later version.

Request Body

Important

You must specify the name for the connection type both in the request body and in the request URI.

{
   "name":"LitwareTwitter",
   "properties":{
      "isGlobal":false,
      "fieldDefinitions":{
         "Owner":{
            "isEncrypted":false,
            "isOptional":false,
            "type":"System.String"
         },
         "ConsuerAPIKey":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "ConsuerAPISecret":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "AccessToken":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "AccessTokenSecret":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         }
      }
   }
}

Element

Description

name

Name of the connection type. Note that the name is also provided in the URI and they must match.

isGlobal

Must be set to false to create a connection type.

fieldDefinitions

Specify a name for each field as array of definitions. In this example the names are City, State, and Rate.

fieldDefinitions/isEncrypted

true to specify that a connection’s value for this field should be encrypted false.

fieldDefintions/isOptional

true to not require a value for this field in a connection; otherwise false.

fieldDefinitions/type

The field's data type. Must be one either System.String, System.In32, or System.Boolean.

Response

Status Code

A successful operation returns 201 (Created). For information about common error codes, see HTTP/1.1 Status Code Definitions.

Response Headers

Request Header

Description

x-ms-request-id

A unique identifier for the current operation.

Response Body

{
   "name":"LitwareTwitter",
   "properties":{
      "isGlobal":false,
      "fieldDefinitions":{
         "Owner":{
            "isEncrypted":false,
            "isOptional":false,
            "type":"System.String"
         },
         "ConsuerAPIKey":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "ConsuerAPISecret":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "AccessToken":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         },
         "AccessTokenSecret":{
            "isEncrypted":true,
            "isOptional":false,
            "type":"System.String"
         }
      },
      "creationTime":"2015-05-18T07:11:31.71+00:00",
      "lastModifiedTime":"2015-05-18T07:11:31.71+00:00"
   }
}

Element

Description

name

Name of the connection type.

isGlobal

Required to be false.

fieldDefintions

The array of fields by their names.

fieldDefinitions/isEncrypted

true to specify that a connection’s value for this field should be encrypted false.

fieldDefinitions/isOptional

true to not require a value for this field in a connection; otherwise false.

fieldDefinitions/type

The field's data type. Must be one either System.String, System.In32, or System.Boolean.

creationTime

Date and time the connection type was created.

lastmodifiedTime

Date and time the connection type was last modified.

See Also

Automation Connections
Operations on Automation