Share via


Service Fabric 建立服務

建立或更新 Service Fabric 服務資源。

使用指定的名稱建立或更新 Service Fabric 服務資源。

要求

方法 要求 URI
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}?api-version=2017-07-01-preview

參數

名稱 類型 必要 Location
subscriptionId string 路徑
resourceGroupName string 路徑
clusterName string 路徑
applicationName 字串 路徑
serviceName string 路徑
api-version string 查詢
parameters ServiceResource body

subscriptionId

類型:字串
必要:是

客戶訂用帳戶識別碼。


resourceGroupName

類型:字串
必要:是

資源群組的名稱。


clusterName

類型:字串
必要:是

叢集資源的名稱。


applicationName

類型:字串
必要:是

應用程式資源的名稱。


serviceName

類型:字串
必要:是

服務資源的名稱,格式為 {applicationName}~{serviceName}。


api-version

類型:字串
必要:是
預設值:2017-07-01-preview

Service Fabric 資源提供者 API 的版本。 這是必要的參數,而且此值必須是此規格的 「2017-07-01-preview」。


參數

類型ServiceResource
必要:是

服務資源。

回應

HTTP 狀態碼 描述 回應結構描述
202 (已接受) 已接受要求,且作業會以非同步方式完成。
ServiceResource
所有其他狀態碼 詳細的錯誤回應。
ErrorModel

範例

使用迷你參數放置服務

要求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService?api-version=2017-07-01-preview
主體
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "properties": {
    "serviceKind": "Stateless",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "instanceCount": "1"
  }
}

202 回應

標題
Retry-After: 10
Location: http://10.91.140.224/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceFabric/locations/eastus/operationResults/5bc615c3-6c5b-4593-80e1-008f55376ec7?api-version=2017-07-01-preview
主體
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "etag": "W/\"636462502183671256\"",
  "properties": {
    "provisioningState": "Updating",
    "serviceKind": "Stateless",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "instanceCount": "1"
  }
}

放置具有最大參數的服務

要求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService?api-version=2017-07-01-preview
主體
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "properties": {
    "serviceKind": "Stateless",
    "placementConstraints": "NodeType==frontend",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "serviceLoadMetrics": [
      {
        "name": "metric1",
        "weight": "Low"
      }
    ],
    "correlationScheme": [
      {
        "serviceName": "fabric:/app1/app1~svc1",
        "scheme": "Affinity"
      }
    ],
    "servicePlacementPolicies": [],
    "defaultMoveCost": "Medium",
    "instanceCount": "5"
  }
}

202 回應

標題
Retry-After: 10
Location: http://10.91.140.224/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ServiceFabric/locations/eastus/operationResults/2e633105-aadc-4928-9164-d76b974170a3?api-version=2017-07-01-preview
主體
{
  "type": "services",
  "location": "eastus",
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/clusters/myCluster/applications/myApp/services/myService",
  "name": "myCluster",
  "tags": {},
  "etag": "W/\"636462502183671258\"",
  "properties": {
    "provisioningState": "Updating",
    "serviceKind": "Stateless",
    "placementConstraints": "NodeType==frontend",
    "serviceTypeName": "myServiceType",
    "partitionDescription": {
      "partitionScheme": "Singleton"
    },
    "serviceLoadMetrics": [
      {
        "name": "metric1",
        "weight": "Low"
      }
    ],
    "servicePlacementPolicies": [],
    "defaultMoveCost": "Medium",
    "instanceCount": "5"
  }
}