Ejemplo n.º 1
0
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as SymbolicLink;

            if (typedSource != null)
            {
                Link           = typedSource.Link;
                ConnectorGroup = typedSource.ConnectorGroup;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("Link", out token) && token.Type != JTokenType.Null)
                {
                    Link = (Uri)serializer.Deserialize(token.CreateReader(), typeof(Uri));
                }
                if (source.TryGetProperty("ConnectorGroup", out token) && token.Type != JTokenType.Null)
                {
                    ConnectorGroup = (ConnectorGroup)serializer.Deserialize(token.CreateReader(), typeof(ConnectorGroup));
                }
            }
        }
Ejemplo n.º 2
0
		public override void Copy(ODataObject source, JsonSerializer serializer)
		{
			if(source == null || serializer == null) return;
			base.Copy(source, serializer);

			var typedSource = source as SymbolicLink;
			if(typedSource != null)
			{
				Link = typedSource.Link;
				ConnectorGroup = typedSource.ConnectorGroup;
			}
			else
			{
				JToken token;
				if(source.TryGetProperty("Link", out token) && token.Type != JTokenType.Null)
				{
					Link = (Uri)serializer.Deserialize(token.CreateReader(), typeof(Uri));
				}
				if(source.TryGetProperty("ConnectorGroup", out token) && token.Type != JTokenType.Null)
				{
					ConnectorGroup = (ConnectorGroup)serializer.Deserialize(token.CreateReader(), typeof(ConnectorGroup));
				}
			}
		}
        /// <summary>
        /// Create a Connector Group associated with a Zone
        /// </summary>
        /// <example>
        /// {
        /// "Zones":[
        /// "Zone": {"Id":"ZoneId"},
        /// "StorageCenter": [ { "Id":"StorageCenterId" }, { ... } ],
        /// "ApiVersionMin":"v3",
        /// "ApiVersionMax":"v3",
        /// "IconUrl":"https://domain/icons",
        /// "FormUrl":"https://domain/forms"
        /// ],
        /// "Id":"ServiceId",
        /// "Name":""Name,
        /// "Provider":"svc"
        /// }
        /// </example>
        /// <remarks>
        /// Creates a new Connector Group, or adds a Zone to an existing Connector Group if the Group is already associated
        /// with another Zone. The caller doesn't have to check if the group exists or not - just call this API passing
        /// the Service ID and the associated Zone information.
        /// </remarks>
        /// <param name="id"></param>
        /// <param name="connectorGroup"></param>
        /// <returns>
        /// the created or modified AccessControl instance
        /// </returns>
        public IQuery<ConnectorGroup> Create(ConnectorGroup connectorGroup)
        {
            var sfApiQuery = new ShareFile.Api.Client.Requests.Query<ConnectorGroup>(Client);
		    sfApiQuery.From("ConnectorGroups");
            sfApiQuery.Body = connectorGroup;
            sfApiQuery.HttpMethod = "POST";	
		    return sfApiQuery;
        }